diff --git a/apps/server/project.json b/apps/server/project.json index d84da6e5..6f789fee 100644 --- a/apps/server/project.json +++ b/apps/server/project.json @@ -98,13 +98,14 @@ "command": "npx graphql-codegen --watch" }, "docker:build": { + "dependsOn": ["build"], "executor": "@nx-tools/nx-container:build", "inputs": ["{projectRoot}/../../dist/apps/server"], "defaultConfiguration": "local", "options": {}, "configurations": { "local": { - "tags": ["pezzolabs/pezzo-private/notifications-service"], + "tags": ["pezzolabs/pezzo/server"], "push": false } } diff --git a/apps/server/src/app/config/common-config-schema.ts b/apps/server/src/app/config/common-config-schema.ts index 39ad1948..94f8ac94 100644 --- a/apps/server/src/app/config/common-config-schema.ts +++ b/apps/server/src/app/config/common-config-schema.ts @@ -15,6 +15,7 @@ const commonConfigSchema = { REDIS_TLS_ENABLED: Joi.boolean().default(false), KMS_REGION: Joi.string().default("us-east-1"), KMS_LOCAL: Joi.boolean().default(true), + KMS_LOCAL_ENDPOINT: Joi.string().default("http://localhost:9981"), KMS_KEY_ARN: Joi.string().default( "arn:aws:kms:us-east-1:111122223333:key/demo-master-key" ), diff --git a/apps/server/src/app/encryption/encryption.service.ts b/apps/server/src/app/encryption/encryption.service.ts index 409a1f65..11d4c0eb 100644 --- a/apps/server/src/app/encryption/encryption.service.ts +++ b/apps/server/src/app/encryption/encryption.service.ts @@ -13,12 +13,18 @@ export class EncryptionService { const isLocalKMS = this.config.get("KMS_LOCAL"); const region = this.config.get("KMS_REGION"); + const endpoint = isLocalKMS + ? this.config.get("KMS_LOCAL_ENDPOINT") + : undefined; + + const credentials = isLocalKMS + ? { accessKeyId: "", secretAccessKey: "" } + : undefined; + this.kms = new KMS({ region, - endpoint: isLocalKMS ? "http://localhost:9981" : undefined, - credentials: isLocalKMS - ? { accessKeyId: "", secretAccessKey: "" } - : undefined, + endpoint, + credentials, }); } diff --git a/docker-compose.infra.yaml b/docker-compose.infra.yaml index 5e1ceb54..33527775 100644 --- a/docker-compose.infra.yaml +++ b/docker-compose.infra.yaml @@ -108,6 +108,8 @@ services: command: '-c "echo \"S2V5czoKICBTeW1tZXRyaWM6CiAgICBBZXM6CiAgICAgIC0gTWV0YWRhdGE6CiAgICAgICAgICBLZXlJZDogZGVtby1tYXN0ZXIta2V5CiAgICAgICAgQmFja2luZ0tleXM6CiAgICAgICAgICAtIDVjZGFlYWQyN2ZlN2RhMmRlNDc5NDVkNzNjZDZkNzllMzY0OTRlNzM4MDJmM2NkMzg2OWYxZDJjYjBiNWQ3YTkKCkFsaWFzZXM6CiAgLSBBbGlhc05hbWU6IGFsaWFzL3Rlc3RpbmcKICAgIFRhcmdldEtleUlkOiBkZW1vLW1hc3Rlci1rZXk=\" | base64 -d >> /init/seed.yaml && local-kms"' ports: - "9981:9981" + expose: + - "9981" environment: - "PORT=9981" - "KMS_REGION=us-east-1" diff --git a/docker-compose.yaml b/docker-compose.yaml index 6c5d3396..ea62ba27 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -31,6 +31,7 @@ services: - SUPERTOKENS_CONNECTION_URI=http://supertokens:3567 - OPENSEARCH_URL=http://opensearch-node1:9200 - REDIS_URL=redis://redis-stack-server:6379 + - KMS_LOCAL_ENDPOINT=http://local-kms:9981 ports: - "3000:3000" depends_on: