From 255e6ae0133f84da0aa00cff45ace93449fd3771 Mon Sep 17 00:00:00 2001 From: RomainMou <58464216+RomainMou@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:04:16 +0100 Subject: [PATCH] Add possibility to customize API swagger texts. --- README.md | 7 +++++++ roles/bimdata/templates/compose-app.yml.j2 | 7 +++++++ roles/prepare_vars/defaults/main/applications.yml | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/README.md b/README.md index b066afe..eae1cde 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,13 @@ Object storage (S3): | api_workers | 8 | Number of web processes to handle requests. | |||| +| api_swagger_customization | false | Enable/Disable API swagger (/doc/) text customization. | +| api_swagger_title | "BIMData API" | API swagger (/doc/) page title. | +| api_swagger_tos | "" | API swagger (/doc/) URL to TOS. | +| api_swagger_contact_name | "Support" | API swagger (/doc/) contact name information. | +| api_swagger_contact_url | "" | API swagger (/doc/) contact URL information. | +| api_swagger_contact_email | "{{ debug_mail_to }}" | API swagger (/doc/) contaxct mail information. | +|||| | connect_secret_key | "{{ vault_connect_secret_key }}" | You should not change this. | | connect_client_id | "{{ 'connect_client_id' \| to_uuid(namespace=uuid_namespace) }}" | You should not change this. | | connect_client_secret | "{{ 'connect_client_secret' \| to_uuid(namespace=uuid_namespace) }}" | You should not change this. | diff --git a/roles/bimdata/templates/compose-app.yml.j2 b/roles/bimdata/templates/compose-app.yml.j2 index 0f80240..3b3efb9 100644 --- a/roles/bimdata/templates/compose-app.yml.j2 +++ b/roles/bimdata/templates/compose-app.yml.j2 @@ -216,6 +216,13 @@ services: {% endif %} {% if tls_acme | bool %} - LETSENCRYPT_HOST={{ api_dns_name }} +{% endif %} +{% if api_swagger_customization | bool %} + - SWAGGER_TITLE={{ api_swagger_title }} + - SWAGGER_TOS={{ api_swagger_tos }} + - SWAGGER_CONTACT_NAME={{ api_swagger_contact_name }} + - SWAGGER_CONTACT_URL={{ api_swagger_contact_url }} + - SWAGGER_CONTACT_EMAIL={{ api_swagger_contact_email }} {% endif %} restart: unless-stopped {% if docker_use_extra_hosts | bool %} diff --git a/roles/prepare_vars/defaults/main/applications.yml b/roles/prepare_vars/defaults/main/applications.yml index 0f6b4ca..4b01b37 100644 --- a/roles/prepare_vars/defaults/main/applications.yml +++ b/roles/prepare_vars/defaults/main/applications.yml @@ -55,6 +55,14 @@ csp_storage_url: "https://{{ s3_storage_connect_bucket_name }}.{{ (s3_endpoint_u api_secret_key: "{{ vault_api_secret_key }}" # Change me in the vault api_workers: 8 +# API swagger (/doc/) +api_swagger_customization: false +api_swagger_title: BIMData API +api_swagger_tos: "" +api_swagger_contact_name: "Support" +api_swagger_contact_url: "" +api_swagger_contact_email: "{{ debug_mail_to }}" + # connect connect_secret_key: "{{ vault_connect_secret_key }}" # Change me in the vault connect_client_id: "{{ 'connect_client_id' | to_uuid(namespace=uuid_namespace) }}"