Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yaonyan
Copy link

@yaonyan yaonyan commented May 11, 2024

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