From b198ae78295960cada9a804d4f27cdb9bcc3f782 Mon Sep 17 00:00:00 2001 From: Berend Sliedrecht <berend@animo.id> Date: Mon, 27 Nov 2023 16:46:32 +0100 Subject: [PATCH] chore: rename peer port to inbound port and remove ext port Signed-off-by: Berend Sliedrecht <berend@animo.id> --- apps/ssi-abstraction/README.md | 1 - apps/ssi-abstraction/deployment/helm/README.md | 3 +-- .../deployment/helm/templates/deployment.yaml | 8 ++------ .../deployment/helm/templates/ingress.yaml | 4 ++-- .../deployment/helm/templates/service.yaml | 7 ++----- apps/ssi-abstraction/deployment/helm/values.yaml | 3 +-- apps/ssi-abstraction/src/agent/agent.service.ts | 8 ++++---- apps/ssi-abstraction/src/config/validation.ts | 2 +- apps/ssi-abstraction/test/setEnvVars.js | 3 +-- 9 files changed, 14 insertions(+), 25 deletions(-) diff --git a/apps/ssi-abstraction/README.md b/apps/ssi-abstraction/README.md index 192eaff..b7faf25 100644 --- a/apps/ssi-abstraction/README.md +++ b/apps/ssi-abstraction/README.md @@ -51,7 +51,6 @@ $ pnpm install [.env.example](.env.example) - PORT is the port for the signing and verification interface -- AFJ_EXT_PORT is the port for the openapi documentation described in [swagger.json](swagger.json) - AGENT_AUTO_ACCEPT_CONNECTION can be either true or false - AGENT_AUTO_ACCEPT_CREDENTIAL can be either: always, contentApproved, never - AGENT_PUBLIC_DID_SEED will generate the did and verkey (32 symbols) diff --git a/apps/ssi-abstraction/deployment/helm/README.md b/apps/ssi-abstraction/deployment/helm/README.md index 7ed99e6..ea4296a 100644 --- a/apps/ssi-abstraction/deployment/helm/README.md +++ b/apps/ssi-abstraction/deployment/helm/README.md @@ -44,13 +44,12 @@ ssi-abstraction deployment | security.runAsNonRoot | bool | `false` | by default, apps run as non-root | | security.runAsUid | int | `0` | User used by the apps | | service.port | int | `3009` | | -| ssiAbstraction.afjExtPort | int | `3010` | | | ssiAbstraction.agent.autoAccept.connection | bool | `true` | | | ssiAbstraction.agent.autoAccept.credential | bool | `true` | | | ssiAbstraction.agent.host | string | `"gaiax.vereign.com"` | | | ssiAbstraction.agent.ledgerId | string | `"ID_UNION"` | | | ssiAbstraction.agent.name | string | `"ssi-abstraction-agent"` | | -| ssiAbstraction.agent.peerPort | int | `443` | | +| ssiAbstraction.agent.inboundPort | int | `443` | | | ssiAbstraction.agent.protocol | string | `"http"` | | | ssiAbstraction.agent.publicDidSeed | string | `"6b8b882e2618fa5d45ee7229ca880083"` | | | ssiAbstraction.agent.urlPath | string | `"/ocm/didcomm"` | | diff --git a/apps/ssi-abstraction/deployment/helm/templates/deployment.yaml b/apps/ssi-abstraction/deployment/helm/templates/deployment.yaml index 576b94f..1996cf0 100644 --- a/apps/ssi-abstraction/deployment/helm/templates/deployment.yaml +++ b/apps/ssi-abstraction/deployment/helm/templates/deployment.yaml @@ -38,8 +38,6 @@ spec: env: - name: PORT value: {{ .Values.service.port | quote }} - - name: AFJ_EXT_PORT - value: {{ .Values.ssiAbstraction.afjExtPort | quote }} - name: DATABASE_URL value: {{ template "app.postgresql.connectionstring" (merge (dict "application" "true") .) }} - name: NATS_URL @@ -52,8 +50,8 @@ spec: value: {{ .Values.ssiAbstraction.agent.urlPath }} - name: AGENT_NAME value: {{ .Values.ssiAbstraction.agent.name }} - - name: AGENT_PEER_PORT - value: ":{{ .Values.ssiAbstraction.agent.peerPort }}" + - name: AGENT_INBOUND_PORT + value: ":{{ .Values.ssiAbstraction.agent.inboundPort }}" - name: AGENT_PUBLIC_DID_SEED value: {{ .Values.ssiAbstraction.agent.publicDidSeed | quote }} - name: AGENT_AUTO_ACCEPT_CONNECTION @@ -80,8 +78,6 @@ spec: {{- end }} - name: http containerPort: {{ .Values.service.port }} - - name: afj - containerPort: {{ .Values.ssiAbstraction.afjExtPort }} - name: peer containerPort: {{ .Values.ssiAbstraction.agent.peerPort }} readinessProbe: diff --git a/apps/ssi-abstraction/deployment/helm/templates/ingress.yaml b/apps/ssi-abstraction/deployment/helm/templates/ingress.yaml index 819267f..ca39338 100644 --- a/apps/ssi-abstraction/deployment/helm/templates/ingress.yaml +++ b/apps/ssi-abstraction/deployment/helm/templates/ingress.yaml @@ -25,5 +25,5 @@ spec: service: name: {{ template "app.name" . }} port: - number: {{ .Values.ssiAbstraction.agent.peerPort }} -{{- end }} \ No newline at end of file + number: {{ .Values.ssiAbstraction.agent.inboundPort }} +{{- end }} diff --git a/apps/ssi-abstraction/deployment/helm/templates/service.yaml b/apps/ssi-abstraction/deployment/helm/templates/service.yaml index 38b7829..599f9d5 100644 --- a/apps/ssi-abstraction/deployment/helm/templates/service.yaml +++ b/apps/ssi-abstraction/deployment/helm/templates/service.yaml @@ -10,10 +10,7 @@ spec: - name: http port: { { .Values.service.port } } targetPort: { { .Values.service.port } } - - name: afj - port: { { .Values.ssiAbstraction.afjExtPort } } - targetPort: { { .Values.ssiAbstraction.afjExtPort } } - name: peer - port: { { .Values.ssiAbstraction.agent.peerPort } } - targetPort: { { .Values.ssiAbstraction.agent.peerPort } } + port: { { .Values.ssiAbstraction.agent.inboundPort } } + targetPort: { { .Values.ssiAbstraction.agent.inboundPort } } selector: { { - include "app.selectorLabels" . | nindent 4 } } diff --git a/apps/ssi-abstraction/deployment/helm/values.yaml b/apps/ssi-abstraction/deployment/helm/values.yaml index c9facef..e0155a6 100644 --- a/apps/ssi-abstraction/deployment/helm/values.yaml +++ b/apps/ssi-abstraction/deployment/helm/values.yaml @@ -90,7 +90,7 @@ ssiAbstraction: name: ssi-abstraction-agent host: gaiax.vereign.com protocol: http - peerPort: 443 + inboundPort: 443 urlPath: /ocm/didcomm publicDidSeed: 6b8b882e2618fa5d45ee7229ca880083 autoAccept: @@ -100,7 +100,6 @@ ssiAbstraction: key: ssi-wallet-key id: ssi-wallet-id ledgerId: ID_UNION - afjExtPort: 3010 database: host: postgresql.infra user: root diff --git a/apps/ssi-abstraction/src/agent/agent.service.ts b/apps/ssi-abstraction/src/agent/agent.service.ts index 343e908..fd5f69f 100644 --- a/apps/ssi-abstraction/src/agent/agent.service.ts +++ b/apps/ssi-abstraction/src/agent/agent.service.ts @@ -49,7 +49,7 @@ export class AgentService { public constructor(configService: ConfigService) { this.configService = configService; - const peerPort = this.configService.get('agent.peerPort'); + const inboundPort = this.configService.get('agent.inboundPort'); this.agent = new Agent({ config: this.config, @@ -58,7 +58,7 @@ export class AgentService { }); const httpInbound = new HttpInboundTransport({ - port: peerPort, + port: inboundPort, }); this.agent.registerInboundTransport(httpInbound); @@ -67,10 +67,10 @@ export class AgentService { } public get config(): InitConfig { - const { name, walletId, walletKey, host, peerPort, path } = + const { name, walletId, walletKey, host, inboundPort, path } = this.configService.get('agent'); - const endpoints = [`${host}${peerPort}${path}`]; + const endpoints = [`${host}${inboundPort}${path}`]; return { label: name, diff --git a/apps/ssi-abstraction/src/config/validation.ts b/apps/ssi-abstraction/src/config/validation.ts index ae47388..ea1891b 100644 --- a/apps/ssi-abstraction/src/config/validation.ts +++ b/apps/ssi-abstraction/src/config/validation.ts @@ -8,7 +8,7 @@ export const validationSchema = Joi.object({ AGENT_WALLET_ID: Joi.string().required(), AGENT_WALLET_KEY: Joi.string().required(), AGENT_HOST: Joi.string().required(), - AGENT_PEER_PORT: Joi.string(), + AGENT_INBOUND_PORT: Joi.string(), AGENT_URL_PATH: Joi.string(), AGENT_PUBLIC_DID_SEED: Joi.string().required(), AGENT_AUTO_ACCEPT_CONNECTION: Joi.boolean().required(), diff --git a/apps/ssi-abstraction/test/setEnvVars.js b/apps/ssi-abstraction/test/setEnvVars.js index 8c0f63d..74a7105 100644 --- a/apps/ssi-abstraction/test/setEnvVars.js +++ b/apps/ssi-abstraction/test/setEnvVars.js @@ -1,12 +1,11 @@ process.env.PORT = 3009; -process.env.AFJ_EXT_PORT = 3010; process.env.DATABASE_URL = 'postgresql://postgres:postgres@localhost:5432/postgres?schema=agent'; process.env.NATS_URL = 'nats://localhost:4222'; process.env.ECSURL = 'http://localhost:9200/'; process.env.AGENT_HOST = 'http://localhost'; process.env.AGENT_NAME = 'ssi-abstraction-agent'; -process.env.AGENT_PEER_PORT = ':4000'; +process.env.AGENT_INBOUND_PORT = ':4000'; process.env.AGENT_URL_PATH = '/ocm/abstraction'; process.env.AGENT_PUBLIC_DID_SEED = '6b8b882e2618fa5d45ee7229ca880083'; process.env.AGENT_AUTO_ACCEPT_CONNECTION = true; -- GitLab