Service implement api or sdk of 3rd party.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { readdir, readFile } = require('node:fs/promises');
|
|
|
|
const path = require('node:path');
|
|
|
|
const fs = require('node:fs');
|
|
|
|
const { resolve } = require('node:path');
|
|
|
|
|
|
|
|
let myAccessKey = '你的AccessKey ID',
|
|
|
|
myAccessSecret = '你的AccessKey Secret';
|
|
|
|
|
|
|
|
//读取自定义配置文件
|
|
|
|
exports.getCustomConfigs = async function(configFile) {
|
|
|
|
let data = null;
|
|
|
|
|
|
|
|
let customConfigFile = resolve(configFile);
|
|
|
|
if (fs.existsSync(customConfigFile)) {
|
|
|
|
try {
|
|
|
|
const contents = await readFile(customConfigFile, { encoding: 'utf8' });
|
|
|
|
if (contents) {
|
|
|
|
data = JSON.parse(contents);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.error(`[FAILED] get config content from %s failed, error: %s`, customConfigFile, err.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.default = {
|
|
|
|
"secret": "Api调用的密钥",
|
|
|
|
|
|
|
|
//阿里云API调用配置
|
|
|
|
"ALIBABA_CLOUD_ACCESS_KEY_ID": myAccessKey,
|
|
|
|
"ALIBABA_CLOUD_ACCESS_KEY_SECRET": myAccessSecret,
|
|
|
|
};
|