Commit f64493ec authored by Sergio Gimenez's avatar Sergio Gimenez
Browse files

Merge remote-tracking branch 'public/main' into feature/lite2edge-integration

parents d51fc7cd a62d62f1
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -12,8 +12,10 @@ variables:
build-mr:
build-mr:
  stage: build
  stage: build
  image:
  image:
    name: gcr.io/kaniko-project/executor:debug
    name: gcr.io/kaniko-project/executor:v1.14.0-debug
    entrypoint: [""]
    entrypoint: [""]
  tags:
    - docker
  before_script:
  before_script:
    - echo "Skip pushing for merge requests"
    - echo "Skip pushing for merge requests"
  script:
  script:
@@ -27,8 +29,10 @@ build-mr:
build-and-push:
build-and-push:
  stage: build
  stage: build
  image:
  image:
    name: gcr.io/kaniko-project/executor:debug
    name: gcr.io/kaniko-project/executor:v1.14.0-debug
    entrypoint: [""]
    entrypoint: [""]
  tags:
    - docker
  before_script:
  before_script:
    - mkdir -p /kaniko/.docker
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
+1 −1
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ experiences across markets.


#### Option A: Docker Compose (Recommended)
#### Option A: Docker Compose (Recommended)
   ```bash
   ```bash
   docker-compose up -d
   docker compose up -d
   ```
   ```
   This starts:
   This starts:
   - Federation Manager (port 8990)
   - Federation Manager (port 8990)
+1 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@ client2_secret = 2mhznERfWclLDuVojY77Lp4Qd2r4e8Ms
scope = fed-mgmt
scope = fed-mgmt
host = keycloak
host = keycloak
port = 8080
port = 8080
realm = federation


[server]
[server]
host = 127.0.0.1
host = 127.0.0.1
+20 −1
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ Federation Manager application
import connexion
import connexion
from flask import render_template
from flask import render_template
import encoder
import encoder
import yaml
from flask_mongoengine import MongoEngine
from flask_mongoengine import MongoEngine
from configparser import ConfigParser
from configparser import ConfigParser


@@ -30,6 +31,9 @@ HOST = CONFIG.get("server", "host")
PORT = int(CONFIG.get("server", "port"))
PORT = int(CONFIG.get("server", "port"))
MONGO_HOST = CONFIG.get("mongodb", "host")
MONGO_HOST = CONFIG.get("mongodb", "host")
MONGO_PORT = CONFIG.get("mongodb", "port")
MONGO_PORT = CONFIG.get("mongodb", "port")
KEYCLOAK_HOST = CONFIG.get("keycloak", "host")
KEYCLOAK_PORT = int(CONFIG.get("keycloak", "port"))
KEYCLOAK_REALM = CONFIG.get("keycloak", "realm")




app = connexion.App(__name__, specification_dir='./swagger/')
app = connexion.App(__name__, specification_dir='./swagger/')
@@ -38,7 +42,22 @@ app.app.config['MONGODB_SETTINGS'] = {
    'host': 'mongodb://' + MONGO_HOST + ':' + MONGO_PORT + '/federation-manager'
    'host': 'mongodb://' + MONGO_HOST + ':' + MONGO_PORT + '/federation-manager'
}
}
DB = MongoEngine(app.app)
DB = MongoEngine(app.app)
app.add_api('swagger.yaml', arguments={'title': 'Federation Management Service'}, pythonic_params=True)

# Load the swagger file and update the tokenUrl dynamically
with open("swagger/swagger.yaml", 'r') as f:
    swagger_spec = yaml.safe_load(f)

token_url = f"http://{KEYCLOAK_HOST}:{KEYCLOAK_PORT}/realms/{KEYCLOAK_REALM}/protocol/openid-connect/token"
swagger_spec['components']['securitySchemes']['oAuth2ClientCredentials']['flows']['clientCredentials']['tokenUrl'] = token_url

# Update the static openapi.yaml file for the UI
try:
    with open("static/openapi.yaml", "w") as f:
        yaml.dump(swagger_spec, f)
except Exception as e:
    print(f"Error updating static/openapi.yaml: {e}")

app.add_api(swagger_spec, arguments={'title': 'Federation Management Service'}, pythonic_params=True)




@app.route("/", methods=["GET"])
@app.route("/", methods=["GET"])
+2004 −2004

File changed.

Preview size limit exceeded, changes collapsed.