Skip to content

feat(cdn): add docs for refreshing with specified env vars - #224

Open
yaonyan wants to merge 1 commit into
tencentyun:masterfrom
yaonyan:master
Open

feat(cdn): add docs for refreshing with specified env vars#224
yaonyan wants to merge 1 commit into
tencentyun:masterfrom
yaonyan:master

Conversation

@yaonyan

@yaonyan yaonyan commented May 11, 2024

Copy link
Copy Markdown

CDN 缓存刷新插件需要指定环境变量才能生效,

function getParams(event) {
const {
TENCENTCLOUD_SECRETID: secretId,
TENCENTCLOUD_SECRETKEY: secretKey,
TENCENTCLOUD_SESSIONTOKEN: token,
Records: records,
ObjectInfo: objectInfo,
...args
} = {
...process.env,
...event,
};
let objects = [];
let triggerType = '';
const missingParams = [
{ key: 'TENCENTCLOUD_SECRETID', value: secretId },
{ key: 'TENCENTCLOUD_SECRETKEY', value: secretKey },
// { key: 'TENCENTCLOUD_SESSIONTOKEN', value: token },
]
.filter(item => !item.value)
.map(item => item.key);
if (missingParams.length) {
throw new Error(`params parsed error, missing params: ${missingParams.join(', ')}`);
}
const cdnHosts = [];
for (const key in args) {
if (/^cdnHosts/.test(key)) {
cdnHosts.push(args[key]);
}
}

此 PR 声明这个隐式依赖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant