From 2a061ed51c33a04bbd762d5ce546f1554505ebca Mon Sep 17 00:00:00 2001 From: yugasun Date: Thu, 15 Apr 2021 17:10:51 +0800 Subject: [PATCH] fix: cors config --- docs/configure.md | 9 ++++----- serverless.component.yml | 2 +- src/utils.js | 4 ++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/configure.md b/docs/configure.md index c47ad95..0e7b37e 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -33,16 +33,15 @@ inputs: grantWrite: id="1234567" grantFullControl: id="1234567" cors: - - id: abc - maxAgeSeconds: '10' + - maxAgeSeconds: 0 allowedMethods: - GET allowedOrigins: - - https://tencent.com + - '*' allowedHeaders: - - FIRST_ALLOWED_HEADER + - '*' exposeHeaders: - - FIRST_EXPOSED_HEADER + - '' tags: - key: abc value: xyz diff --git a/serverless.component.yml b/serverless.component.yml index 892593f..a3de8e3 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: cos -version: 0.2.2 +version: 0.2.3 author: 'Tencent Cloud, Inc.' org: 'Tencent Cloud, Inc.' description: Deploy Tencent COS. diff --git a/src/utils.js b/src/utils.js index 20a7cd2..f7b2b2f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -33,6 +33,10 @@ async function formatInputs(instance, inputs) { } } + if (inputs.cors) { + formatedInputs.cors = inputs.cors + } + if (inputs.website === true) { const websiteConfig = inputs.websiteConfig || {} formatedInputs.ignoreHtmlExt = websiteConfig.ignoreHtmlExt