From f9eee9bf7e77f0e15c63ffd63f3f428f5a68326a Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Sat, 27 Jul 2024 09:01:17 -0400 Subject: [PATCH] fix: add a site id to razzle api path (#8) * fix: add a site id to razzle api path * fix test output * fix package.json * camelCase Du olles Kamel * chore: self mutation Signed-off-by: github-actions --------- Signed-off-by: github-actions Co-authored-by: github-actions --- API.md | 11 +++++++++++ src/plone.ts | 7 ++++++- test/__snapshots__/plone.test.ts.snap | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index 149ce84..344c003 100644 --- a/API.md +++ b/API.md @@ -261,6 +261,7 @@ const ploneOptions: PloneOptions = { ... } | backend | PloneBaseOptions | *No description.* | | frontend | PloneBaseOptions | *No description.* | | imagePullSecrets | string[] | *No description.* | +| siteId | string | *No description.* | | version | string | *No description.* | --- @@ -295,6 +296,16 @@ public readonly imagePullSecrets: string[]; --- +##### `siteId`Optional + +```typescript +public readonly siteId: string; +``` + +- *Type:* string + +--- + ##### `version`Optional ```typescript diff --git a/src/plone.ts b/src/plone.ts index 97db3ee..6806333 100644 --- a/src/plone.ts +++ b/src/plone.ts @@ -17,6 +17,7 @@ export interface PloneBaseOptions { } export interface PloneOptions { readonly version?: string; + readonly siteId?: string; readonly backend?: PloneBaseOptions; readonly frontend?: PloneBaseOptions; readonly imagePullSecrets?: string[]; @@ -30,6 +31,10 @@ export class Plone extends Construct { constructor(scope: Construct, id: string, options: PloneOptions = {}) { super(scope, id); + // ------------------------------------------------------------------------ + // General + const siteId = options.siteId ?? 'Plone'; + // ------------------------------------------------------------------------ // Backend const backend = options.backend ?? {}; @@ -134,7 +139,7 @@ export class Plone extends Construct { var frontendEnvironment = frontend.environment ?? new kplus.Env([], {}); if (frontendEnvironment.variables.RAZZLE_INTERNAL_API_PATH === undefined) { // connect with backend service - frontendEnvironment?.addVariable('RAZZLE_INTERNAL_API_PATH', kplus.EnvValue.fromValue(`http://${backendService.name}:${backendPort}`)); + frontendEnvironment?.addVariable('RAZZLE_INTERNAL_API_PATH', kplus.EnvValue.fromValue(`http://${backendService.name}:${backendPort}/${siteId}`)); } // Deployment diff --git a/test/__snapshots__/plone.test.ts.snap b/test/__snapshots__/plone.test.ts.snap index 6b6de6a..f922c08 100644 --- a/test/__snapshots__/plone.test.ts.snap +++ b/test/__snapshots__/plone.test.ts.snap @@ -151,7 +151,7 @@ exports[`defaults 1`] = ` "env": [ { "name": "RAZZLE_INTERNAL_API_PATH", - "value": "http://app-plone-backend-service-c8efef4c:8080", + "value": "http://app-plone-backend-service-c8efef4c:8080/Plone", }, ], "envFrom": [], @@ -391,7 +391,7 @@ exports[`defaults-with-pdps 1`] = ` "env": [ { "name": "RAZZLE_INTERNAL_API_PATH", - "value": "http://app-plone_with_pdbs-backend-service-c819541f:8080", + "value": "http://app-plone_with_pdbs-backend-service-c819541f:8080/Plone", }, ], "envFrom": [],