feat: Allow SSE For S3 Buckets

Signed-off-by: therynamo <theryn.groetken@gemini.com>
This commit is contained in:
therynamo
2021-11-17 14:05:57 -06:00
parent a4faa290b8
commit 3f7931bedc
3 changed files with 16 additions and 0 deletions
@@ -161,6 +161,7 @@ export function registerCommands(program: CommanderStatic) {
'--awsEndpoint <AWS ENDPOINT>',
'Optional AWS endpoint to send requests to.',
)
.option('--awsS3sse <AWS SSE>', 'Optional AWS S3 Server Side Encryption.')
.option(
'--awsS3ForcePathStyle',
'Optional AWS S3 option to force path style.',
@@ -80,6 +80,20 @@ describe('getValidPublisherConfig', () => {
actualConfig.getString('techdocs.publisher.awsS3.bucketRootPath'),
).toBe('backstage-data/techdocs');
});
it('should return valid ConfigReader with SSE option', () => {
const config = {
publisherType: 'awsS3',
storageName: 'someStorageName',
awsS3sse: 'aws:kms',
} as unknown as Command;
const actualConfig = PublisherConfig.getValidConfig(config);
expect(actualConfig.getString('techdocs.publisher.type')).toBe('awsS3');
expect(actualConfig.getString('techdocs.publisher.awsS3.sse')).toBe(
'aws:kms',
);
});
});
describe('for openStackSwift', () => {
@@ -89,6 +89,7 @@ export class PublisherConfig {
...(cmd.awsRoleArn && { credentials: { roleArn: cmd.awsRoleArn } }),
...(cmd.awsEndpoint && { endpoint: cmd.awsEndpoint }),
...(cmd.awsS3ForcePathStyle && { s3ForcePathStyle: true }),
...(cmd.awsS3sse && { sse: cmd.awsS3sse }),
},
};
}