feat(codecommit-integration): Make region mandatory

Signed-off-by: Stijn Brouwers (EISMEA) <stijn@bdcommit.com>
This commit is contained in:
Stijn Brouwers (EISMEA)
2024-05-18 09:24:29 +02:00
committed by blam
parent dcb75ee4c0
commit 786a8d0443
3 changed files with 8 additions and 2 deletions
@@ -39,3 +39,7 @@ integrations:
roleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/example-role'
externalId: 'some-id' # optional
```
Each entry is a structure with the following required elements:
- `region`: The AWS region to connect to, to communicate with the CodeCommit services. If no host is provided, this value will be used to determine the host url.
@@ -29,7 +29,9 @@ describe('readAwsCodeCommitIntegrationConfig', () => {
}
it('reads all values (default)', () => {
const output = readAwsCodeCommitIntegrationConfig(buildConfig({}));
const output = readAwsCodeCommitIntegrationConfig(
buildConfig({ region: 'us-east-1' }),
);
expect(output).toEqual({
host: `us-east-1.${AMAZON_AWS_CODECOMMIT_HOST}`,
region: `us-east-1`,
@@ -69,7 +69,7 @@ export function readAwsCodeCommitIntegrationConfig(
const secretAccessKey = config.getOptionalString('secretAccessKey')?.trim();
const roleArn = config.getOptionalString('roleArn');
const externalId = config.getOptionalString('externalId');
const region = config.getOptionalString('region') || 'us-east-1';
const region = config.getString('region');
const host =
config.getOptionalString('host') ||
`${region}.${AMAZON_AWS_CODECOMMIT_HOST}`;