### Start Application in Development Profile (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command starts the application in the development profile using Gradle. It's the primary command for local development and testing. ```bash ./gradlew ``` -------------------------------- ### Start Local Sonar Server (Docker Compose) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command starts a local SonarQube server using Docker Compose. It's used for static code analysis and quality gate checks. ```bash docker-compose -f src/main/docker/sonar.yml up -d ``` -------------------------------- ### Get All Configurations (Internal API) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves all configurations, potentially for internal microservice communication. Supports fetching all configurations, configurations at a specific version, or specific configurations by providing a list of paths. Requires the 'x-tenant' header. ```bash # Get all configurations curl -X GET "http://localhost:8080/api/private/config_map" \ -H "x-tenant: XM" ``` ```bash # Get configurations at specific version curl -X GET "http://localhost:8080/api/private/config_map?version=abc123" \ -H "x-tenant: XM" ``` ```bash # Get specific configurations by paths curl -X POST "http://localhost:8080/api/private/config_map" \ -H "Content-Type: application/json" \ -H "x-tenant: XM" \ -d '{"version": "abc123", "paths": ["/config/tenants/XM/entity/spec.yml"]}' ``` -------------------------------- ### Get Configuration (Bash) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves a configuration file by its path using a GET request. It supports retrieving the configuration as-is (YAML), converted to JSON by appending `?toJson`, or at a specific version using the `?version` query parameter. The response includes the configuration content and appropriate content type. ```bash # Get configuration as-is curl -X GET "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Get configuration converted to JSON curl -X GET "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml?toJson" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Get configuration at specific version curl -X GET "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml?version=abc123def" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` -------------------------------- ### Get Multiple Configurations by Paths Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves multiple configuration files in a single request by specifying their paths. Supports fetching a specific list of configurations or all tenant configurations using a query parameter. ```bash # Get specific configurations by paths curl -X POST "http://localhost:8080/api/profile/configs_map" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d '["entity/spec.yml", "webapp/settings.yml"]' # Response: 200 OK # { # "/config/tenants/DEMO/entity/spec.yml": {"path": "...", "content": "..."}, # "/config/tenants/DEMO/webapp/settings.yml": {"path": "...", "content": "..."} # } # Fetch all tenant configurations curl -X POST "http://localhost:8080/api/profile/configs_map?fetchAll=true" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d '[]' # Response: 200 OK # {all tenant configurations} ``` -------------------------------- ### Get Multiple Configurations by Paths Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves multiple configuration files in a single request, either by specifying paths or fetching all configurations. ```APIDOC ## POST /api/profile/configs_map ### Description Retrieves multiple configuration files in a single request. ### Method POST ### Endpoint /api/profile/configs_map ### Parameters #### Query Parameters - **fetchAll** (boolean) - Optional - If true, fetches all tenant configurations. #### Request Body - **(array of strings)** - A JSON array of configuration paths to retrieve. If `fetchAll` is true, this array should be empty. ### Request Example (Specific Paths) ```bash curl -X POST "http://localhost:8080/api/profile/configs_map" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d '["entity/spec.yml", "webapp/settings.yml"]' ``` ### Request Example (Fetch All) ```bash curl -X POST "http://localhost:8080/api/profile/configs_map?fetchAll=true" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d '[]' ``` ### Response #### Success Response (200) - **(object)** - A map where keys are configuration paths and values contain path and content. - **path** (string) - The full path to the configuration. - **content** (string) - The content of the configuration file. #### Response Example ```json { "/config/tenants/DEMO/entity/spec.yml": {"path": "...", "content": "..."}, "/config/tenants/DEMO/webapp/settings.yml": {"path": "...", "content": "..."} } ``` ``` -------------------------------- ### Get Services for Tenant Source: https://context7.com/xm-online/xm-ms-config/llms.txt Lists all microservices where a specific tenant is registered. This endpoint helps understand the scope of a tenant's presence within the system. ```bash curl -X GET "http://localhost:8080/api/tenants/DEMO/services" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" # Response: 200 OK ``` -------------------------------- ### Get Tenants Source: https://context7.com/xm-online/xm-ms-config/llms.txt Lists all tenants registered for a specific microservice. The response is a JSON array of tenant objects, each containing the tenant's name and state. ```bash curl -X GET "http://localhost:8080/api/tenants/entity" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" # Response: 200 OK # [ # {"name": "XM", "state": "ACTIVE"}, # {"name": "DEMO", "state": "ACTIVE"}, # {"name": "TEST", "state": "SUSPENDED"} # ] ``` -------------------------------- ### GET /api/config/tenants/{tenant}/entity/{entityPath} Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves a configuration file by path. Supports YAML to JSON conversion and versioned access. ```APIDOC ## GET /api/config/tenants/{tenant}/entity/{entityPath} ### Description Retrieves a configuration file by path. Supports YAML to JSON conversion and versioned access. ### Method GET ### Endpoint /api/config/tenants/{tenant}/entity/{entityPath} ### Parameters #### Path Parameters - **tenant** (string) - Required - The tenant identifier. - **entityPath** (string) - Required - The path to the configuration file (e.g., spec.yml). #### Query Parameters - **toJson** (boolean) - Optional - If present, the configuration will be returned as JSON. - **version** (string) - Optional - Retrieves the configuration at a specific version. #### Request Body None ### Request Example ```bash # Get configuration as-is curl -X GET "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Get configuration converted to JSON curl -X GET "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml?toJson" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Get configuration at specific version curl -X GET "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml?version=abc123def" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` ### Response #### Success Response (200 OK) - **Content-Type** (string) - The content type of the response (e.g., `text/plain` for YAML, `application/json;charset=UTF-8` for JSON). - **Body** - The content of the configuration file (YAML or JSON). #### Response Example ``` # Response: 200 OK # Content-Type: text/plain # Body: (YAML content) # Response: 200 OK # Content-Type: application/json;charset=UTF-8 # Body: {"types":[{"key":"USER",...}]} ``` ``` -------------------------------- ### Get Persisted Configurations from Git Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves configurations directly from the Git repository, bypassing the in-memory cache for the most up-to-date versions. Also provides an endpoint to get hash sums for configurations stored in Git. ```bash # Get all configurations from Git curl -X POST "http://localhost:8080/api/profile/configs_git_map?fetchAll=true" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d '[]' # Response: 200 OK # {configurations from Git} # Get Git configuration hash sums curl -X GET "http://localhost:8080/api/profile/configs_git_hash" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Response: 200 OK # {"hashSums": [...]} ``` -------------------------------- ### Get Client Configuration Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves configuration files for the current tenant context. Supports fetching specific files like entity specs or webapp settings, with options for JSON output or processed content. Public webapp settings do not require authentication. ```bash # Get configuration for current tenant curl -X GET "http://localhost:8080/api/profile/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Response: 200 OK # Body: (YAML content) # Get webapp public settings curl -X GET "http://localhost:8080/api/profile/webapp/settings-public.yml?toJson" \ -H "x-tenant: DEMO" # Response: 200 OK (no authentication required for public settings) # Body: {"theme": "light", "language": "en", ...} # Get webapp private settings curl -X GET "http://localhost:8080/api/profile/webapp/settings-private.yml?processed" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Response: 200 OK ``` -------------------------------- ### Get Configuration Hash Sums Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves SHA-256 hash sums for all configurations of a specific tenant. ```APIDOC ## GET /api/config/tenants/{tenantId}/hash ### Description Retrieves SHA-256 hash sums for all configurations of a tenant. ### Method GET ### Endpoint /api/config/tenants/{tenantId}/hash ### Parameters #### Path Parameters - **tenantId** (string) - Required - The ID of the tenant. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8080/api/config/tenants/DEMO/hash" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` ### Response #### Success Response (200) - **hashSums** (array) - A list of objects, each containing a configuration path and its hash sum. - **path** (string) - The path to the configuration file. - **hashSum** (string) - The SHA-256 hash sum of the configuration file. #### Response Example ```json { "hashSums": [ {"path": "/config/tenants/DEMO/entity/spec.yml", "hashSum": "a1b2c3..."}, {"path": "/config/tenants/DEMO/webapp/settings.yml", "hashSum": "d4e5f6..."} ] } ``` ``` -------------------------------- ### Get Configurations by Pattern (Internal API) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves configurations that match specified ant-style path patterns. This endpoint is useful for fetching multiple related configuration files. It requires a version and a list of pattern paths in the JSON payload. ```bash curl -X POST "http://localhost:8080/api/private/config_map/pattern" \ -H "Content-Type: application/json" \ -H "x-tenant: XM" \ -d '{ \ "version": "abc123", \ "patternPaths": ["/config/tenants/*/entity/**", "/config/tenants/*/webapp/*.yml"] \ }' ``` -------------------------------- ### Get Configuration Version Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves the current configuration version, represented by a Git commit hash. ```APIDOC ## GET /api/version ### Description Retrieves the current configuration version (Git commit hash). ### Method GET ### Endpoint /api/version ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8080/api/version" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200) - **string** - The Git commit hash representing the configuration version. #### Response Example ```json "abc123def456789" ``` ``` -------------------------------- ### Get Persisted Configurations from Git Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves configurations directly from the Git repository, bypassing the in-memory cache, and also provides an endpoint for Git configuration hash sums. ```APIDOC ## POST /api/profile/configs_git_map ### Description Retrieves configurations directly from the Git repository, bypassing the in-memory cache. ### Method POST ### Endpoint /api/profile/configs_git_map ### Parameters #### Query Parameters - **fetchAll** (boolean) - Required - Set to `true` to fetch all tenant configurations from Git. #### Request Body - **(array)** - An empty array `[]` when `fetchAll` is true. ### Request Example ```bash curl -X POST "http://localhost:8080/api/profile/configs_git_map?fetchAll=true" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d '[]' ``` ### Response #### Success Response (200) - **(object)** - Contains configurations fetched directly from Git. ## GET /api/profile/configs_git_hash ### Description Retrieves SHA-256 hash sums for configurations stored in the Git repository. ### Method GET ### Endpoint /api/profile/configs_git_hash ### Parameters None ### Request Example ```bash curl -X GET "http://localhost:8080/api/profile/configs_git_hash" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` ### Response #### Success Response (200) - **hashSums** (array) - A list of objects, each containing a configuration path and its hash sum from Git. - **path** (string) - The path to the configuration file in Git. - **hashSum** (string) - The SHA-256 hash sum of the configuration file. #### Response Example ```json {"hashSums": [...]} ``` ``` -------------------------------- ### Get Configuration Hash Sums Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves SHA-256 hash sums for all configurations belonging to a specific tenant. This can be used for integrity checks or to detect configuration changes. ```bash curl -X GET "http://localhost:8080/api/config/tenants/DEMO/hash" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" # Response: 200 OK # { # "hashSums": [ # {"path": "/config/tenants/DEMO/entity/spec.yml", "hashSum": "a1b2c3..."}, # {"path": "/config/tenants/DEMO/webapp/settings.yml", "hashSum": "d4e5f6..."} # ] # } ``` -------------------------------- ### Get Configuration Version Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves the current configuration version, typically represented by a Git commit hash. This endpoint is useful for tracking the deployed configuration state. ```bash curl -X GET "http://localhost:8080/api/version" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" # Response: 200 OK # Body: "abc123def456789" ``` -------------------------------- ### Get JWT Public Key Source: https://context7.com/xm-online/xm-ms-config/llms.txt Retrieves the public key used for verifying JSON Web Tokens (JWT). This is essential for clients to validate the authenticity of tokens issued by the system. The response includes the algorithm and the public key value. ```bash curl -X GET "http://localhost:8080/api/token_key" ``` -------------------------------- ### Create Tenant Source: https://context7.com/xm-online/xm-ms-config/llms.txt Registers a new tenant for a specific microservice. The tenant name is provided as plain text in the request body. ```bash curl -X POST "http://localhost:8080/api/tenants/entity" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: XM" \ -d 'DEMO' # Response: 200 OK ``` -------------------------------- ### Build Production WAR (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command packages the application as a WAR file, suitable for deployment to traditional application servers. It includes production optimizations. ```bash ./gradlew -Pprod -Pwar clean bootWar ``` -------------------------------- ### Create Configuration (Bash) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Creates a new configuration file for a specific tenant using a POST request. It requires admin privileges and specifies the tenant and file path in the URL, with the configuration content in the request body. The response indicates success with a 201 Created status. ```bash curl -X POST "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: DEMO" \ -d 'types: - key: USER name: en: User uk: Користувач dataSpec: - name: firstName type: String - name: lastName type: String' ``` -------------------------------- ### Run Application with Docker Compose Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command deploys the application and its dependencies using Docker Compose. It assumes the Docker image has already been built. ```bash docker-compose -f src/main/docker/app.yml up -d ``` -------------------------------- ### Batch Upload Configurations (Bash) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Uploads multiple configuration files in a single request. This can be done by sending individual files via multipart form data or by uploading a ZIP archive containing the configuration files. The `x-tenant` header specifies the target tenant for the upload. ```bash # Upload multiple files via multipart curl -X POST "http://localhost:8080/api/config" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" \ -F "files=@/path/to/config1.yml" \ -F "files=@/path/to/config2.yml" # Upload entire configuration from ZIP curl -X POST "http://localhost:8080/api/config/zip" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" \ -F "file=@/path/to/config-archive.zip" ``` -------------------------------- ### POST /api/config/tenants/{tenant}/entity/{entityPath} Source: https://context7.com/xm-online/xm-ms-config/llms.txt Creates a new configuration file for a specific tenant. Requires admin privileges. ```APIDOC ## POST /api/config/tenants/{tenant}/entity/{entityPath} ### Description Creates a new configuration file for a specific tenant. Requires admin privileges. ### Method POST ### Endpoint /api/config/tenants/{tenant}/entity/{entityPath} ### Parameters #### Path Parameters - **tenant** (string) - Required - The tenant identifier. - **entityPath** (string) - Required - The path to the configuration file (e.g., spec.yml). #### Query Parameters None #### Request Body - **body** (text/plain) - Required - The content of the configuration file. ### Request Example ```bash curl -X POST "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: DEMO" \ -d 'types:\n - key: USER\n name:\n en: User\n uk: Користувач\n dataSpec:\n - name: firstName\n type: String\n - name: lastName\n type: String' ``` ### Response #### Success Response (201 Created) - **Location** (string) - The URL of the created configuration file. #### Response Example ``` # Response: 201 Created # Location: /api/config/tenants/DEMO/entity/spec.yml ``` ``` -------------------------------- ### Run Application Tests (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command executes all defined tests for the application using Gradle. It's crucial for ensuring code correctness and stability. ```bash ./gradlew test ``` -------------------------------- ### Build Docker Image for Application (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command builds a Docker image of the application using the Jib Gradle plugin, optimized for production. It's a prerequisite for Dockerized deployment. ```bash ./gradlew bootJar -Pprod jibDockerBuild ``` -------------------------------- ### Build Production JAR (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command builds the final JAR file optimized for production. It cleans previous builds, applies production configurations, and packages the application. ```bash ./gradlew -Pprod clean bootJar ``` -------------------------------- ### Tenant Management API Source: https://context7.com/xm-online/xm-ms-config/llms.txt Endpoints for managing tenants, including creation, state updates, and listing. ```APIDOC ## Tenant Management API ### POST Create Tenant Registers a new tenant for a specific microservice. #### Method POST #### Endpoint /api/tenants/entity #### Parameters #### Request Body - **(string)** - Required - The name of the tenant to create. ### Request Example ```bash curl -X POST "http://localhost:8080/api/tenants/entity" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: XM" \ -d 'DEMO' ``` ### Response #### Success Response (200) - **(empty)** - Indicates the tenant was created successfully. ### PUT Update Tenant State Updates the state (active, suspended, etc.) of a tenant for a specific service. #### Method PUT #### Endpoint /api/tenants/entity/{tenantId} #### Parameters ##### Path Parameters - **tenantId** (string) - Required - The ID of the tenant whose state to update. ##### Request Body - **(string)** - Required - The new state for the tenant (e.g., 'ACTIVE', 'SUSPENDED'). ### Request Example ```bash curl -X PUT "http://localhost:8080/api/tenants/entity/DEMO" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: XM" \ -d 'ACTIVE' ``` ### Response #### Success Response (200) - **(empty)** - Indicates the tenant state was updated successfully. ### GET Get Tenants Lists all tenants registered for a specific microservice. #### Method GET #### Endpoint /api/tenants/entity #### Parameters None ### Request Example ```bash curl -X GET "http://localhost:8080/api/tenants/entity" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200) - **(array of objects)** - A list of tenants registered for the microservice. - **name** (string) - The name of the tenant. - **state** (string) - The current state of the tenant (e.g., 'ACTIVE', 'SUSPENDED'). #### Response Example ```json [ {"name": "XM", "state": "ACTIVE"}, {"name": "DEMO", "state": "ACTIVE"}, {"name": "TEST", "state": "SUSPENDED"} ] ``` ### GET Get Services for Tenant Lists all microservices where a specific tenant is registered. #### Method GET #### Endpoint /api/tenants/{tenantId}/services #### Parameters ##### Path Parameters - **tenantId** (string) - Required - The ID of the tenant. ### Request Example ```bash curl -X GET "http://localhost:8080/api/tenants/DEMO/services" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200) - **(array of strings)** - A list of microservices where the tenant is registered. ``` -------------------------------- ### Run Production JAR Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command executes the built production JAR file. It's used to verify the production build and run the application standalone. ```bash java -jar build/libs/*.jar ``` -------------------------------- ### POST /api/config Source: https://context7.com/xm-online/xm-ms-config/llms.txt Uploads multiple configuration files using multipart form data. ```APIDOC ## POST /api/config ### Description Uploads multiple configuration files using multipart form data. ### Method POST ### Endpoint /api/config ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **files** (multipart/form-data) - Required - One or more configuration files to upload. ### Request Example ```bash curl -X POST "http://localhost:8080/api/config" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" \ -F "files=@/path/to/config1.yml" \ -F "files=@/path/to/config2.yml" ``` ### Response #### Success Response (200 OK) Indicates the files were uploaded successfully. #### Response Example ``` # Response: 200 OK ``` ``` -------------------------------- ### POST /api/config/reclone Source: https://context7.com/xm-online/xm-ms-config/llms.txt Reclones the entire Git repository to refresh configurations. ```APIDOC ## POST /api/config/reclone ### Description Reclones the entire Git repository to refresh configurations. ### Method POST ### Endpoint /api/config/reclone ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X POST "http://localhost:8080/api/config/reclone" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200 OK) Indicates the Git repository was re-cloned successfully. #### Response Example ``` # Response: 200 OK ``` ``` -------------------------------- ### Run Sonar Analysis (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command performs a SonarQube analysis on the codebase. It integrates with Gradle tasks for cleaning, testing, reporting, and Sonar analysis. ```bash ./gradlew -Pprod clean check jacocoTestReport sonarqube ``` -------------------------------- ### Configuration Client API Source: https://context7.com/xm-online/xm-ms-config/llms.txt Endpoints for retrieving and managing client-specific configurations. ```APIDOC ## Configuration Client API ### GET Client Configuration Retrieves configuration for the current tenant context (profile-scoped access). #### Method GET #### Endpoint /api/profile/entity/spec.yml #### Parameters None #### Request Body None ### Request Example (Current Tenant) ```bash curl -X GET "http://localhost:8080/api/profile/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` ### Response (Current Tenant) #### Success Response (200) - **(YAML content)** - The content of the entity specification file. ### GET Webapp Public Settings Retrieves public settings for the web application. #### Method GET #### Endpoint /api/profile/webapp/settings-public.yml?toJson #### Parameters - **toJson** (boolean) - Optional - If true, returns settings in JSON format. #### Request Body None ### Request Example (Public Settings) ```bash curl -X GET "http://localhost:8080/api/profile/webapp/settings-public.yml?toJson" \ -H "x-tenant: DEMO" ``` ### Response (Public Settings) #### Success Response (200) - **(JSON object)** - Public webapp settings. #### Response Example ```json {"theme": "light", "language": "en", ...} ``` ### GET Webapp Private Settings Retrieves processed private settings for the web application. #### Method GET #### Endpoint /api/profile/webapp/settings-private.yml?processed #### Parameters - **processed** (boolean) - Optional - If true, returns processed settings. #### Request Body None ### Request Example (Private Settings) ```bash curl -X GET "http://localhost:8080/api/profile/webapp/settings-private.yml?processed" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` ### Response (Private Settings) #### Success Response (200) - **(Content)** - Processed private webapp settings. ``` -------------------------------- ### POST /api/config/refresh/ Source: https://context7.com/xm-online/xm-ms-config/llms.txt Reloads configurations from the persistence layer (Git/S3) into memory. ```APIDOC ## POST /api/config/refresh/ ### Description Reloads configurations from the persistence layer (Git/S3) into memory. ### Method POST ### Endpoint /api/config/refresh/ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash # Refresh all configurations curl -X POST "http://localhost:8080/api/config/refresh/" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200 OK) Indicates the configurations were reloaded successfully. #### Response Example ``` # Response: 200 OK ``` ``` -------------------------------- ### Update Configurations from List Source: https://context7.com/xm-online/xm-ms-config/llms.txt Updates multiple configurations in a single batch operation. Requires a JSON payload containing an array of objects, each specifying the path and new content for a configuration file. ```bash curl -X POST "http://localhost:8080/api/profile/configs_update" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d \ '[ {"path": "/config/tenants/DEMO/entity/spec.yml", "content": "types:\n - key: USER"}, {"path": "/config/tenants/DEMO/webapp/settings.yml", "content": "theme: dark"} ]' # Response: 200 OK ``` -------------------------------- ### POST /api/config/zip Source: https://context7.com/xm-online/xm-ms-config/llms.txt Uploads an entire configuration from a ZIP archive. ```APIDOC ## POST /api/config/zip ### Description Uploads an entire configuration from a ZIP archive. ### Method POST ### Endpoint /api/config/zip ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **file** (multipart/form-data) - Required - The ZIP archive containing configuration files. ### Request Example ```bash curl -X POST "http://localhost:8080/api/config/zip" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" \ -F "file=@/path/to/config-archive.zip" ``` ### Response #### Success Response (200 OK) Indicates the ZIP archive was processed successfully. #### Response Example ``` # Response: 200 OK ``` ``` -------------------------------- ### POST /api/config/refresh/tenants/{tenant}/entity/{entityPath} Source: https://context7.com/xm-online/xm-ms-config/llms.txt Refreshes a specific configuration file from the persistence layer. ```APIDOC ## POST /api/config/refresh/tenants/{tenant}/entity/{entityPath} ### Description Refreshes a specific configuration file from the persistence layer (Git/S3) into memory. ### Method POST ### Endpoint /api/config/refresh/tenants/{tenant}/entity/{entityPath} ### Parameters #### Path Parameters - **tenant** (string) - Required - The tenant identifier. - **entityPath** (string) - Required - The path to the configuration file to refresh. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X POST "http://localhost:8080/api/config/refresh/tenants/DEMO/entity/spec.yml" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200 OK) Indicates the specified configuration was reloaded successfully. #### Response Example ``` # Response: 200 OK ``` ``` -------------------------------- ### Private Config Map API Source: https://context7.com/xm-online/xm-ms-config/llms.txt Endpoints for retrieving configurations, including all configurations, configurations by version, specific paths, and pattern matching. ```APIDOC ## GET /api/private/config_map ### Description Retrieves all configurations for internal microservice communication. ### Method GET ### Endpoint `/api/private/config_map` ### Query Parameters - **version** (string) - Optional - The specific version of configurations to retrieve. ### Headers - **x-tenant** (string) - Required - The tenant context. ### Request Example (Get all configurations) ```bash curl -X GET "http://localhost:8080/api/private/config_map" \ -H "x-tenant: XM" ``` ### Request Example (Get configurations at specific version) ```bash curl -X GET "http://localhost:8080/api/private/config_map?version=abc123" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200 OK) - **{config_path}** (object) - The path and content of a configuration file. - **path** (string) - The path to the configuration file. - **content** (string) - The content of the configuration file. ### Response Example ```json { "/config/tenants/XM/entity/spec.yml": {"path": "...", "content": "..."}, "/config/tenants/XM/webapp/settings.yml": {"path": "...", "content": "..."} } ``` ``` ```APIDOC ## POST /api/private/config_map ### Description Retrieves specific configurations by providing a list of paths and an optional version. ### Method POST ### Endpoint `/api/private/config_map` ### Headers - **Content-Type** (string) - Required - `application/json`. - **x-tenant** (string) - Required - The tenant context. ### Request Body - **version** (string) - Optional - The specific version of configurations to retrieve. - **paths** (array of strings) - Required - A list of configuration paths to retrieve. ### Request Example ```bash curl -X POST "http://localhost:8080/api/private/config_map" \ -H "Content-Type: application/json" \ -H "x-tenant: XM" \ -d '{"version": "abc123", "paths": ["/config/tenants/XM/entity/spec.yml"]}' ``` ### Response #### Success Response (200 OK) - **{config_path}** (object) - The path and content of a configuration file. - **path** (string) - The path to the configuration file. - **content** (string) - The content of the configuration file. ### Response Example ```json { "/config/tenants/XM/entity/spec.yml": {"path": "...", "content": "..."} } ``` ``` ```APIDOC ## POST /api/private/config_map/pattern ### Description Retrieves configurations matching ant-style path patterns. ### Method POST ### Endpoint `/api/private/config_map/pattern` ### Headers - **Content-Type** (string) - Required - `application/json`. - **x-tenant** (string) - Required - The tenant context. ### Request Body - **version** (string) - Optional - The specific version of configurations to retrieve. - **patternPaths** (array of strings) - Required - A list of ant-style path patterns to match configurations. ### Request Example ```bash curl -X POST "http://localhost:8080/api/private/config_map/pattern" \ -H "Content-Type: application/json" \ -H "x-tenant: XM" \ -d '{ "version": "abc123", "patternPaths": ["/config/tenants/*/entity/**", "/config/tenants/*/webapp/*.yml"] }' ``` ### Response #### Success Response (200 OK) - **{matching configurations}** (object) - An object containing the configurations that match the provided patterns. ``` -------------------------------- ### S3 Repository Configuration (application.yml) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Specifies the application's configuration for using an S3-compatible object storage as a configuration backend. This includes S3 endpoint, credentials, bucket details, and path filtering rules (include/exclude). It is particularly useful for MinIO deployments. ```yaml # application.yml - S3 backend configuration application: config-repository: mode: S3 s3: endpoint: http://localhost:9000 accessKey: ${S3_ACCESS_KEY} secretKey: ${S3_SECRET_KEY} region: eu-central-1 bucket: xm-config configPath: xm-config pathStyleAccess: true # Required for MinIO rules: includePaths: - /config/tenants/* - /config/global/* excludePaths: - /config/legacy/* ``` -------------------------------- ### Update Configurations from List Source: https://context7.com/xm-online/xm-ms-config/llms.txt Updates multiple configurations in a batch operation by providing a list of paths and their new content. ```APIDOC ## POST /api/profile/configs_update ### Description Updates multiple configurations in a batch operation. ### Method POST ### Endpoint /api/profile/configs_update ### Parameters #### Request Body - **(array of objects)** - A JSON array where each object represents a configuration to update. - **path** (string) - Required - The full path of the configuration to update. - **content** (string) - Required - The new content for the configuration. ### Request Example ```bash curl -X POST "http://localhost:8080/api/profile/configs_update" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "x-tenant: DEMO" \ -d \ '[ {"path": "/config/tenants/DEMO/entity/spec.yml", "content": "types:\n - key: USER"}, {"path": "/config/tenants/DEMO/webapp/settings.yml", "content": "theme: dark"} ]' ``` ### Response #### Success Response (200) - **(empty)** - Indicates the update operation was successful. ``` -------------------------------- ### Git Repository Configuration (application.yml) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Defines the application's configuration for connecting to a Git repository as a backend. This includes repository URI, credentials, branch, and cloning behavior. It also supports SSH-based authentication with private key configuration. ```yaml # application.yml - Git backend configuration application: git: uri: git@github.com:organization/config-repo.git login: git-user password: ${GIT_PASSWORD} branchName: master depth: -1 # Full clone (-1) or shallow clone (positive number) maxWaitTimeSecond: 30 cloneRepositoryOnUpdate: false ssh: enabled: true privateKey: ${GIT_PRIVATE_KEY} passPhrase: ${GIT_PASS_PHRASE} acceptUnknownHost: true ``` -------------------------------- ### Kafka Configuration (application.yml) Source: https://context7.com/xm-online/xm-ms-config/llms.txt Configures the application's integration with Kafka for receiving configuration change notifications. This section defines Kafka bootstrap servers, consumer group ID, deserializers, and producer serializers. It also includes application-level settings for enabling Kafka and specifying system queues. ```yaml # application.yml - Kafka integration for config change notifications spring: kafka: bootstrap-servers: localhost:9092 consumer: group-id: config key-deserializer: org.apache.kafka.common.serialization.StringDeserializer value-deserializer: org.apache.kafka.common.serialization.StringDeserializer producer: key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer application: kafka-enabled: true kafka-system-queue: system_queue kafka-metadata-max-age: 60000 ``` -------------------------------- ### PUT /api/config/tenants/{tenant}/entity/{entityPath} Source: https://context7.com/xm-online/xm-ms-config/llms.txt Updates an existing configuration file with optional optimistic locking via hash verification. ```APIDOC ## PUT /api/config/tenants/{tenant}/entity/{entityPath} ### Description Updates an existing configuration file with optional optimistic locking via hash verification. ### Method PUT ### Endpoint /api/config/tenants/{tenant}/entity/{entityPath} ### Parameters #### Path Parameters - **tenant** (string) - Required - The tenant identifier. - **entityPath** (string) - Required - The path to the configuration file (e.g., spec.yml). #### Query Parameters - **oldConfigHash** (string) - Optional - The hash of the configuration to verify for optimistic locking. #### Request Body - **body** (text/plain) - Required - The updated content of the configuration file. ### Request Example ```bash curl -X PUT "http://localhost:8080/api/config/tenants/DEMO/entity/spec.yml?oldConfigHash=abc123" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: DEMO" \ -d 'types:\n - key: USER\n name:\n en: User\n uk: Користувач\n dataSpec:\n - name: firstName\n type: String\n - name: lastName\n type: String\n - name: email\n type: String' ``` ### Response #### Success Response (200 OK) Indicates the configuration was updated successfully. #### Error Response (409 Conflict) Indicates a hash mismatch, meaning the configuration was modified by another user since it was fetched. #### Response Example ``` # Response: 200 OK (success) or 409 Conflict (hash mismatch) ``` ``` -------------------------------- ### Tenant Management API Source: https://context7.com/xm-online/xm-ms-config/llms.txt Endpoints for managing tenants within the microservice, including deletion and setting parent-child relationships. ```APIDOC ## DELETE /api/tenants/{service}/{tenantId} ### Description Removes a tenant from a specific microservice. ### Method DELETE ### Endpoint `/api/tenants/{service}/{tenantId}` ### Parameters #### Path Parameters - **service** (string) - Required - The microservice name. - **tenantId** (string) - Required - The ID of the tenant to delete. #### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **x-tenant** (string) - Required - The tenant context. ### Request Example ```bash curl -X DELETE "http://localhost:8080/api/tenants/entity/DEMO" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: XM" ``` ### Response #### Success Response (200 OK) Indicates the tenant was successfully removed. ``` ```APIDOC ## POST /api/tenants/set_parent ### Description Establishes a parent-child relationship between tenants for configuration inheritance. ### Method POST ### Endpoint `/api/tenants/set_parent` ### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **Content-Type** (string) - Required - `text/plain`. - **x-tenant** (string) - Required - The tenant context for the child tenant. ### Request Body - **parentTenantId** (string) - Required - The ID of the parent tenant. ### Request Example ```bash curl -X POST "http://localhost:8080/api/tenants/set_parent" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: text/plain" \ -H "x-tenant: DEMO" \ -d 'XM' ``` ### Response #### Success Response (200 OK) Indicates the parent-child relationship was successfully established. ``` -------------------------------- ### Run Gatling Performance Tests (Gradle) Source: https://github.com/xm-online/xm-ms-config/blob/master/README.md This command runs performance tests using Gatling, which are written in Scala and located in src/test/gatling. This helps in assessing application performance under load. ```bash ./gradlew gatlingRun ``` -------------------------------- ### Refresh Tenant Configuration Source: https://context7.com/xm-online/xm-ms-config/llms.txt Reloads configurations for the current tenant from persistence, ensuring the latest version is used. ```APIDOC ## POST /api/profile/refresh/ ### Description Reloads configurations for the current tenant from persistence. ### Method POST ### Endpoint /api/profile/refresh/ ### Parameters None ### Request Body None ### Request Example ```bash curl -X POST "http://localhost:8080/api/profile/refresh/" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-tenant: DEMO" ``` ### Response #### Success Response (200) - **(empty)** - Indicates the refresh operation was successful. ```