Skip to content

Commit cb1e02b

Browse files
point to task manager secrets managher
1 parent be82400 commit cb1e02b

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

scripts/populate-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Define the secret name and region
4-
SECRET_NAME="/helix-deploy/spacecat-services/api-service/latest"
4+
SECRET_NAME="/helix-deploy/spacecat-services/task-manager/latest"
55
REGION="us-east-1"
66

77
# Retrieve the secret from AWS Secrets Manager

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const HANDLERS = {
2929

3030
// Custom secret name resolver to use the correct secret path
3131
function getSecretName() {
32-
return '/helix-deploy/spacecat-services/api-service/latest';
32+
return '/helix-deploy/spacecat-services/task-manager/latest';
3333
}
3434

3535
// Export for testing

src/tasks/demo-url-processor/handler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ const TASK_TYPE = 'demo-url-processor';
2525
function getImsTenantId(organization, context, log) {
2626
const { name, imsOrgId } = organization;
2727
try {
28-
const imsOrgToTenantMapping = context.env.IMSORG_TO_TENANT;
28+
const imsOrgToTenantMapping = context.env.IMS_ORG_TENANT_ID_MAPPINGS;
2929
if (imsOrgToTenantMapping) {
3030
const mapping = JSON.parse(imsOrgToTenantMapping);
3131
if (mapping[imsOrgId]) {
3232
return mapping[imsOrgId];
3333
}
3434
}
3535
} catch (error) {
36-
log.error('Error loading IMSORG_TO_TENANT mapping:', error.message);
36+
log.error('Error loading IMS_ORG_TENANT_ID_MAPPINGS mapping:', error.message);
3737
}
3838
return name.toLowerCase().replace(/\s+/g, '');
3939
}

test/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('Index Tests', () => {
124124

125125
it('should cover getSecretName function', () => {
126126
const secretName = getSecretName();
127-
expect(secretName).to.equal('/helix-deploy/spacecat-services/api-service/latest');
127+
expect(secretName).to.equal('/helix-deploy/spacecat-services/task-manager/latest');
128128
});
129129

130130
it('should handle handler throwing an error', async () => {

test/tasks/demo-url-processor/demo-url-processor.test.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ describe('Demo URL Processor', () => {
6464

6565
describe('runDemoUrlProcessor', () => {
6666
it('should process demo URL successfully', async () => {
67-
// Set up the IMSORG_TO_TENANT secret in context
68-
context.env.IMSORG_TO_TENANT = JSON.stringify({
67+
// Set up the IMS_ORG_TENANT_ID_MAPPINGS secret in context
68+
context.env.IMS_ORG_TENANT_ID_MAPPINGS = JSON.stringify({
6969
'8C6043F15F43B6390A49401A@AdobeOrg': 'aem-sites-engineering',
7070
});
7171

@@ -81,8 +81,8 @@ describe('Demo URL Processor', () => {
8181
});
8282

8383
it('should handle missing slackContext in taskContext', async () => {
84-
// Set up the IMSORG_TO_TENANT secret in context
85-
context.env.IMSORG_TO_TENANT = JSON.stringify({
84+
// Set up the IMS_ORG_TENANT_ID_MAPPINGS secret in context
85+
context.env.IMS_ORG_TENANT_ID_MAPPINGS = JSON.stringify({
8686
'8C6043F15F43B6390A49401A@AdobeOrg': 'aem-sites-engineering',
8787
});
8888

@@ -92,9 +92,9 @@ describe('Demo URL Processor', () => {
9292
expect(context.log.info.calledWith(`Setup complete! Access your demo environment here: ${expectedDemoUrl}`)).to.be.true;
9393
});
9494

95-
it('should use IMSORG_TO_TENANT mapping when available', async () => {
96-
// Set up the IMSORG_TO_TENANT secret in context
97-
context.env.IMSORG_TO_TENANT = JSON.stringify({
95+
it('should use IMS_ORG_TENANT_ID_MAPPINGS mapping when available', async () => {
96+
// Set up the IMS_ORG_TENANT_ID_MAPPINGS secret in context
97+
context.env.IMS_ORG_TENANT_ID_MAPPINGS = JSON.stringify({
9898
'8C6043F15F43B6390A49401A@AdobeOrg': 'aem-sites-engineering',
9999
});
100100

@@ -105,9 +105,9 @@ describe('Demo URL Processor', () => {
105105
expect(context.log.info.calledWith(`Setup complete! Access your demo environment here: ${expectedDemoUrl}`)).to.be.true;
106106
});
107107

108-
it('should fallback to name-based tenant when IMSORG_TO_TENANT mapping is not available', async () => {
109-
// Don't set IMSORG_TO_TENANT secret
110-
delete context.env.IMSORG_TO_TENANT;
108+
it('should fallback to name-based tenant when IMS_ORG_TENANT_ID_MAPPINGS mapping is not available', async () => {
109+
// Don't set IMS_ORG_TENANT_ID_MAPPINGS secret
110+
delete context.env.IMS_ORG_TENANT_ID_MAPPINGS;
111111

112112
await runDemoUrlProcessor(message, context);
113113

@@ -116,9 +116,9 @@ describe('Demo URL Processor', () => {
116116
expect(context.log.info.calledWith(`Setup complete! Access your demo environment here: ${expectedDemoUrl}`)).to.be.true;
117117
});
118118

119-
it('should fallback to name-based tenant when IMSORG_TO_TENANT mapping is invalid JSON', async () => {
120-
// Set invalid JSON in IMSORG_TO_TENANT secret
121-
context.env.IMSORG_TO_TENANT = 'invalid-json';
119+
it('should fallback to name-based tenant when IMS_ORG_TENANT_ID_MAPPINGS mapping is invalid JSON', async () => {
120+
// Set invalid JSON in IMS_ORG_TENANT_ID_MAPPINGS secret
121+
context.env.IMS_ORG_TENANT_ID_MAPPINGS = 'invalid-json';
122122

123123
await runDemoUrlProcessor(message, context);
124124

@@ -127,9 +127,9 @@ describe('Demo URL Processor', () => {
127127
expect(context.log.info.calledWith(`Setup complete! Access your demo environment here: ${expectedDemoUrl}`)).to.be.true;
128128
});
129129

130-
it('should fallback to name-based tenant when IMSORG_TO_TENANT mapping does not contain the imsOrgId', async () => {
131-
// Set IMSORG_TO_TENANT secret with different mapping
132-
context.env.IMSORG_TO_TENANT = JSON.stringify({
130+
it('should fallback to name-based tenant when IMS_ORG_TENANT_ID_MAPPINGS mapping does not contain the imsOrgId', async () => {
131+
// Set IMS_ORG_TENANT_ID_MAPPINGS secret with different mapping
132+
context.env.IMS_ORG_TENANT_ID_MAPPINGS = JSON.stringify({
133133
'DIFFERENT_ORG_ID@AdobeOrg': 'different-team',
134134
});
135135

0 commit comments

Comments
 (0)