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.
34 lines
942 B
34 lines
942 B
'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); |
|
console.log(customConfigFile); |
|
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 = { |
|
"ALIBABA_CLOUD_ACCESS_KEY_ID": myAccessKey, |
|
"ALIBABA_CLOUD_ACCESS_KEY_SECRET": myAccessSecret, |
|
}; |