diff --git a/ormconfig.js b/ormconfig.js index 9b7d0b1d..ed43e333 100644 --- a/ormconfig.js +++ b/ormconfig.js @@ -1,7 +1,18 @@ -require('dotenv').config(); - +const fs = require('fs'); 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'); moment.tz.setDefault('UTC');