From 8a2fa6bbf01aa108960908dab3e271dbc7d0c319 Mon Sep 17 00:00:00 2001 From: Elwin Schmitz Date: Thu, 30 Jan 2025 16:13:43 +0100 Subject: [PATCH] Misc. collection of fixes/tweaks and other things... (#6442) * chore: Add documentation-link * fix: Typo in action-step name * dx: Make sure to use closest ESLint-version * docs: Add missing ENV-variable * docs: Align README about certificates with other FSP See #6413 * dx: Hide unnecessary elements in Squagger-UI * fix: Prevent Petstore-Inception-bug Resolves AB#24724 (hopefully, partly) * feat: Hide useless filter-bar --- .github/actions/build-service/action.yml | 2 +- .github/release.yml | 6 +++-- .vscode/settings.json | 1 + services/.env.example | 1 + services/121-service/src/config.ts | 1 + services/121-service/src/main.ts | 4 ++-- .../commercial-bank-ethiopia/README.md | 22 +++++++++++++++---- services/mock-service/src/main.ts | 13 ++++++++--- 8 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/actions/build-service/action.yml b/.github/actions/build-service/action.yml index be9375acb7..e47aef96cb 100644 --- a/.github/actions/build-service/action.yml +++ b/.github/actions/build-service/action.yml @@ -73,7 +73,7 @@ runs: rm -r -f test/ rm -r -f ./*.md - - name: Creating ZIP package + - name: Create ZIP package shell: bash working-directory: ${{ inputs.servicePath }} run: zip --quiet --display-globaldots --recurse-paths artifact.zip . diff --git a/.github/release.yml b/.github/release.yml index 36dad140d9..e2ddcaf91e 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,8 +1,10 @@ +# See: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes + changelog: exclude: labels: - - dependencies # dependabot - - ignore-for-release # manually excluded + - dependencies # Dependabot + - ignore-for-release # Manually excluded categories: - title: New Features 🎉 labels: diff --git a/.vscode/settings.json b/.vscode/settings.json index 0c45e6cce6..d04cf49d39 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", "eslint.enable": true, "eslint.format.enable": true, + "eslint.workingDirectories": [{ "mode": "auto" }], "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.removeUnusedImports": "explicit" diff --git a/services/.env.example b/services/.env.example index 64239dabf3..698f884174 100644 --- a/services/.env.example +++ b/services/.env.example @@ -284,6 +284,7 @@ MOCK_SAFARICOM=TRUE COMMERCIAL_BANK_ETHIOPIA_URL= COMMERCIAL_BANK_ETHIOPIA_PASSWORD=test-COMMERCIAL_BANK_ETHIOPIA_PASSWORD COMMERCIAL_BANK_ETHIOPIA_USERNAME=test-COMMERCIAL_BANK_ETHIOPIA_USERNAME +COMMERCIAL_BANK_ETHIOPIA_CERTIFICATE_PATH= # To use a mock version of the COMMERCIAL BANK ETHIOPIA API, use: `TRUE` to enable, leave empty or out to disable. MOCK_COMMERCIAL_BANK_ETHIOPIA=TRUE diff --git a/services/121-service/src/config.ts b/services/121-service/src/config.ts index 7be11b3517..6d3c1261ca 100644 --- a/services/121-service/src/config.ts +++ b/services/121-service/src/config.ts @@ -31,6 +31,7 @@ export const APP_FAVICON = favIconUrl; export const SWAGGER_CUSTOM_CSS = ` .swagger-ui .topbar { background: ${headerStyle}; } .swagger-ui .topbar .link { visibility: hidden; } + .swagger-ui .scheme-container { display: none; } `; export const SWAGGER_CUSTOM_JS = ` const loc = window.location; diff --git a/services/121-service/src/main.ts b/services/121-service/src/main.ts index 03217488c9..4c14285710 100644 --- a/services/121-service/src/main.ts +++ b/services/121-service/src/main.ts @@ -174,9 +174,9 @@ async function bootstrap(): Promise { deepLinking: true, defaultModelExpandDepth: 10, defaultModelsExpandDepth: 1, - displayOperationId: true, + displayOperationId: DEBUG, displayRequestDuration: true, - filter: true, + filter: false, operationsSorter: 'alpha', persistAuthorization: DEBUG, queryConfigEnabled: DEBUG, diff --git a/services/121-service/src/payments/fsp-integration/commercial-bank-ethiopia/README.md b/services/121-service/src/payments/fsp-integration/commercial-bank-ethiopia/README.md index 63422c3293..5273175bc0 100644 --- a/services/121-service/src/payments/fsp-integration/commercial-bank-ethiopia/README.md +++ b/services/121-service/src/payments/fsp-integration/commercial-bank-ethiopia/README.md @@ -31,10 +31,24 @@ Follow these steps to successfully integrate your Dockerized application with th - Identify the specific API endpoints provided by Commercial Bank Ethiopia that need to be accessed through the VPN. - Update your application's API calls to use the VPN server's address and port. -6. **TLS Certificate Handling** - - To enable loading Certificate files via ENV-variables in the Azure App-Service Configuration needs to have set `WEBSITE_LOAD_CERTIFICATES=*`. - - In the Azure Potal, in the instance's App-Service/Settings/Certificates the public key certificate (.cer) can be uploaded (and named). This will result in a "thumbprint", which will be used as the filename for the Certificate. - - The location of the certificate needs to be set in the ENV-variable: `COMMERCIAL_BANK_ETHIOPIA_CERTIFICATE_PATH=/var/ssl/certs/.der`. +6. **Enable Certificate loading** + + - Set the `WEBSITE_LOAD_CERTIFICATES=*` environment variable in the Azure App Service configuration. + +7. **Upload Certificate** + + - In the Azure Portal, navigate to the instance's **App Service** > **Settings** > **Certificates**. + - Press 'Public key certificates (.cer)' + - Upload the public key certificate (`.cer` file) and name it. + - This will generate a "thumbprint" which will be used as the filename for the certificate. + +8. **Configure Certificate-path** + + - The location of the certificate needs to be set in the environment variable: + + ```dotenv + COMMERCIAL_BANK_ETHIOPIA_CERTIFICATE_PATH=/var/ssl/certs/.der + ``` ## Conclusion diff --git a/services/mock-service/src/main.ts b/services/mock-service/src/main.ts index 1c72059c5d..5aa0999bc4 100644 --- a/services/mock-service/src/main.ts +++ b/services/mock-service/src/main.ts @@ -7,6 +7,7 @@ import { import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import * as bodyParser from 'body-parser'; +import { Response } from 'express'; import { ApplicationModule } from '@mock-service/src/app.module'; import { @@ -37,6 +38,7 @@ async function bootstrap(): Promise { const expressInstance = app.getHttpAdapter().getInstance(); expressInstance.disable('x-powered-by'); + expressInstance.set('strict routing', true); // Required to prevent Petstore-Inception-bug app.setGlobalPrefix('api'); @@ -45,7 +47,8 @@ async function bootstrap(): Promise { .setVersion(APP_VERSION) .build(); const document = SwaggerModule.createDocument(app, options); - SwaggerModule.setup('/docs', app, document, { + // To prevent Petstore-Inception-bug the trailing slash is required! + SwaggerModule.setup('/docs/', app, document, { customSiteTitle: APP_TITLE, customfavIcon: APP_FAVICON, customCss: SWAGGER_CUSTOM_CSS, @@ -54,9 +57,9 @@ async function bootstrap(): Promise { deepLinking: true, defaultModelExpandDepth: 10, defaultModelsExpandDepth: 1, - displayOperationId: true, + displayOperationId: DEVELOPMENT, displayRequestDuration: true, - filter: true, + filter: false, operationsSorter: 'alpha', queryConfigEnabled: DEVELOPMENT, showCommonExtensions: true, @@ -65,6 +68,10 @@ async function bootstrap(): Promise { tryItOutEnabled: DEVELOPMENT, }, }); + // Use root as easy-default entrypoint + expressInstance.use(/^\/$/, (_req: unknown, res: Response) => + res.redirect('/docs/'), + ); app.useGlobalPipes( new ValidationPipe({