mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
ormconfig: load api or bot .env, whichever exists
This commit is contained in:
parent
688249cbb8
commit
51a9b2bfa5
1 changed files with 13 additions and 2 deletions
15
ormconfig.js
15
ormconfig.js
|
@ -1,7 +1,18 @@
|
||||||
require('dotenv').config();
|
const fs = require('fs');
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.accessSync(path.resolve(__dirname, 'bot.env'));
|
||||||
|
require('dotenv').config({ path: path.resolve(__dirname, 'bot.env') });
|
||||||
|
} catch (e) {
|
||||||
|
try {
|
||||||
|
fs.accessSync(path.resolve(__dirname, 'api.env'));
|
||||||
|
require('dotenv').config({ path: path.resolve(__dirname, 'api.env') });
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error("bot.env or api.env required");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const moment = require('moment-timezone');
|
const moment = require('moment-timezone');
|
||||||
moment.tz.setDefault('UTC');
|
moment.tz.setDefault('UTC');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue