123456789101112131415161718192021222324252627282930313233343536 |
- const fs = require('fs')
- const qcloud = require('wafer-node-sdk')
- const configs = require('./config')
- const sdkConfig = (() => {
- const sdkConfigPath = '/data/release/sdk.config.json'
-
- try {
- const stats = fs.statSync(sdkConfigPath)
- if (!stats.isFile()) {
- console.log('sdk.config.json 不存在,将使用 config.js 中的配置')
- return {}
- }
- } catch (e) {
- return {}
- }
-
- try {
- const content = fs.readFileSync(sdkConfigPath, 'utf8')
- return JSON.parse(content)
- } catch (e) {
-
- console.log('sdk.config.json 解析错误,不是 JSON 字符串')
- return {}
- }
- })()
- module.exports = qcloud(Object.assign({}, sdkConfig, configs))
|