更多的云函数自定义变量

This commit is contained in:
shylocks
2021-01-25 11:11:26 +08:00
parent 8cebfd4ffb
commit d3c20ccdc7
2 changed files with 4 additions and 2 deletions

View File

@@ -166,3 +166,5 @@ jobs:
SERVERLESS_PLATFORM_VENDOR: tencent SERVERLESS_PLATFORM_VENDOR: tencent
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }}
TENCENT_REGION: ${{ secrets.TENCENT_REGION }}
TENCENT_FUNCTION_NAME: ${{ secrets.TENCENT_FUNCTION_NAME }}

View File

@@ -11,7 +11,7 @@ const clientConfig = {
secretId: process.env.TENCENT_SECRET_ID, secretId: process.env.TENCENT_SECRET_ID,
secretKey: process.env.TENCENT_SECRET_KEY, secretKey: process.env.TENCENT_SECRET_KEY,
}, },
region: "ap-hongkong", region: process.env.TENCENT_REGION, // 区域参考https://cloud.tencent.com/document/product/213/6091
profile: { profile: {
httpProfile: { httpProfile: {
endpoint: "scf.tencentcloudapi.com", endpoint: "scf.tencentcloudapi.com",
@@ -22,7 +22,7 @@ const clientConfig = {
const client = new ScfClient(clientConfig); const client = new ScfClient(clientConfig);
const params = { const params = {
"Handler": "index.main_handler", "Handler": "index.main_handler",
"FunctionName": "jd", "FunctionName": process.env.TENCENT_FUNCTION_NAME, // 云函数程序名,例如 jd_scripts
"ZipFile": contents_in_base64 "ZipFile": contents_in_base64
}; };
client.UpdateFunctionCode(params).then( client.UpdateFunctionCode(params).then(