Skip to content

Commit

Permalink
Misc. collection of fixes/tweaks and other things... (#6442)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
elwinschmitz authored Jan 30, 2025
1 parent fabe51a commit 8a2fa6b
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-service/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
6 changes: 4 additions & 2 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions services/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions services/121-service/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions services/121-service/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ async function bootstrap(): Promise<void> {
deepLinking: true,
defaultModelExpandDepth: 10,
defaultModelsExpandDepth: 1,
displayOperationId: true,
displayOperationId: DEBUG,
displayRequestDuration: true,
filter: true,
filter: false,
operationsSorter: 'alpha',
persistAuthorization: DEBUG,
queryConfigEnabled: DEBUG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/<thumbprint>.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/<thumbprint>.der
```

## Conclusion

Expand Down
13 changes: 10 additions & 3 deletions services/mock-service/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -37,6 +38,7 @@ async function bootstrap(): Promise<void> {
const expressInstance = app.getHttpAdapter().getInstance();

expressInstance.disable('x-powered-by');
expressInstance.set('strict routing', true); // Required to prevent Petstore-Inception-bug

app.setGlobalPrefix('api');

Expand All @@ -45,7 +47,8 @@ async function bootstrap(): Promise<void> {
.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,
Expand All @@ -54,9 +57,9 @@ async function bootstrap(): Promise<void> {
deepLinking: true,
defaultModelExpandDepth: 10,
defaultModelsExpandDepth: 1,
displayOperationId: true,
displayOperationId: DEVELOPMENT,
displayRequestDuration: true,
filter: true,
filter: false,
operationsSorter: 'alpha',
queryConfigEnabled: DEVELOPMENT,
showCommonExtensions: true,
Expand All @@ -65,6 +68,10 @@ async function bootstrap(): Promise<void> {
tryItOutEnabled: DEVELOPMENT,
},
});
// Use root as easy-default entrypoint
expressInstance.use(/^\/$/, (_req: unknown, res: Response) =>
res.redirect('/docs/'),
);

app.useGlobalPipes(
new ValidationPipe({
Expand Down

0 comments on commit 8a2fa6b

Please sign in to comment.