mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
重构环境变量管理,添加脚本查看
This commit is contained in:
@@ -5,13 +5,15 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const envFound = dotenv.config();
|
||||
const rootPath = path.resolve(__dirname, '../../');
|
||||
const cookieFile = path.join(rootPath, 'config/cookie.sh');
|
||||
const envFile = path.join(rootPath, 'config/env.sh');
|
||||
const confFile = path.join(rootPath, 'config/config.sh');
|
||||
const sampleFile = path.join(rootPath, 'sample/config.sample.sh');
|
||||
const crontabFile = path.join(rootPath, 'config/crontab.list');
|
||||
const confBakDir = path.join(rootPath, 'config/bak/');
|
||||
const authConfigFile = path.join(rootPath, 'config/auth.json');
|
||||
const extraFile = path.join(rootPath, 'config/extra.sh');
|
||||
const configPath = path.join(rootPath, 'config/');
|
||||
const scriptPath = path.join(rootPath, 'scripts/');
|
||||
const logPath = path.join(rootPath, 'log/');
|
||||
const authError = '错误的用户名密码,请重试';
|
||||
const loginFaild = '请先登录!';
|
||||
@@ -19,7 +21,7 @@ const configString = 'config sample crontab shareCode diy';
|
||||
const dbPath = path.join(rootPath, 'db/');
|
||||
const manualLogPath = path.join(rootPath, 'manual_log/');
|
||||
const cronDbFile = path.join(rootPath, 'db/crontab.db');
|
||||
const cookieDbFile = path.join(rootPath, 'db/cookie.db');
|
||||
const envDbFile = path.join(rootPath, 'db/env.db');
|
||||
const configFound = dotenv.config({ path: confFile });
|
||||
|
||||
if (envFound.error) {
|
||||
@@ -50,14 +52,12 @@ export default {
|
||||
crontabFile,
|
||||
sampleFile,
|
||||
confFile,
|
||||
cookieFile,
|
||||
fileMap: {
|
||||
'config.sh': confFile,
|
||||
'crontab.list': crontabFile,
|
||||
'extra.sh': extraFile,
|
||||
},
|
||||
envFile,
|
||||
dbPath,
|
||||
cronDbFile,
|
||||
cookieDbFile,
|
||||
envDbFile,
|
||||
manualLogPath,
|
||||
configPath,
|
||||
scriptPath,
|
||||
blackFileList: ['auth.json', 'config.sh.sample', 'cookie.sh', 'crontab.list'],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user