From 3f7931bedce241f9d304cf0a55083fb3e772a106 Mon Sep 17 00:00:00 2001 From: therynamo Date: Wed, 17 Nov 2021 14:05:57 -0600 Subject: [PATCH 1/2] feat: Allow SSE For S3 Buckets Signed-off-by: therynamo --- packages/techdocs-cli/src/commands/index.ts | 1 + .../techdocs-cli/src/lib/PublisherConfig.test.ts | 14 ++++++++++++++ packages/techdocs-cli/src/lib/PublisherConfig.ts | 1 + 3 files changed, 16 insertions(+) diff --git a/packages/techdocs-cli/src/commands/index.ts b/packages/techdocs-cli/src/commands/index.ts index 280072cfd9..d4f41cf7a3 100644 --- a/packages/techdocs-cli/src/commands/index.ts +++ b/packages/techdocs-cli/src/commands/index.ts @@ -161,6 +161,7 @@ export function registerCommands(program: CommanderStatic) { '--awsEndpoint ', 'Optional AWS endpoint to send requests to.', ) + .option('--awsS3sse ', 'Optional AWS S3 Server Side Encryption.') .option( '--awsS3ForcePathStyle', 'Optional AWS S3 option to force path style.', diff --git a/packages/techdocs-cli/src/lib/PublisherConfig.test.ts b/packages/techdocs-cli/src/lib/PublisherConfig.test.ts index 519972c03d..88f542c049 100644 --- a/packages/techdocs-cli/src/lib/PublisherConfig.test.ts +++ b/packages/techdocs-cli/src/lib/PublisherConfig.test.ts @@ -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', () => { diff --git a/packages/techdocs-cli/src/lib/PublisherConfig.ts b/packages/techdocs-cli/src/lib/PublisherConfig.ts index e855d573ce..d4779995c0 100644 --- a/packages/techdocs-cli/src/lib/PublisherConfig.ts +++ b/packages/techdocs-cli/src/lib/PublisherConfig.ts @@ -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 }), }, }; } From f2694e3750e6ce73f32d639eafc9720e160894b4 Mon Sep 17 00:00:00 2001 From: therynamo Date: Wed, 17 Nov 2021 14:08:14 -0600 Subject: [PATCH 2/2] changeset Signed-off-by: therynamo --- .changeset/techdocs-real-geese-dress.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/techdocs-real-geese-dress.md diff --git a/.changeset/techdocs-real-geese-dress.md b/.changeset/techdocs-real-geese-dress.md new file mode 100644 index 0000000000..3c440935d7 --- /dev/null +++ b/.changeset/techdocs-real-geese-dress.md @@ -0,0 +1,5 @@ +--- +'@techdocs/cli': patch +--- + +Adds ability to use encrypted s3 buckets by utilizing the SSE option in the aws sdk