mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
初始化api
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const envFound = dotenv.config();
|
||||
const rootPath = path.resolve(__dirname, '../../');
|
||||
const confFile = path.join(rootPath, 'config/config.sh');
|
||||
const sampleFile = path.join(rootPath, 'sample/config.sh.sample');
|
||||
const crontabFile = path.join(rootPath, 'config/crontab.list');
|
||||
const confBakDir = path.join(rootPath, 'config/bak/');
|
||||
const authConfigFile = path.join(rootPath, 'config/auth.json');
|
||||
const shareCodeDir = path.join(rootPath, 'log/jd_get_share_code/');
|
||||
const diyFile = path.join(rootPath, 'config/diy.sh');
|
||||
const logPath = path.join(rootPath, 'log/');
|
||||
const authError = '错误的用户名密码,请重试';
|
||||
const loginFaild = '请先登录!';
|
||||
const configString = 'config sample crontab shareCode diy';
|
||||
|
||||
if (envFound.error) {
|
||||
throw new Error("⚠️ Couldn't find .env file ⚠️");
|
||||
}
|
||||
|
||||
export default {
|
||||
port: parseInt(process.env.PORT, 10),
|
||||
secret: process.env.SECRET,
|
||||
logs: {
|
||||
level: process.env.LOG_LEVEL || 'silly',
|
||||
},
|
||||
api: {
|
||||
prefix: '/api',
|
||||
},
|
||||
configString,
|
||||
loginFaild,
|
||||
authError,
|
||||
logPath,
|
||||
diyFile,
|
||||
shareCodeDir,
|
||||
authConfigFile,
|
||||
confBakDir,
|
||||
crontabFile,
|
||||
sampleFile,
|
||||
confFile,
|
||||
};
|
||||
Reference in New Issue
Block a user