26 lines
832 B
JavaScript
26 lines
832 B
JavaScript
/**
|
|
* Environment variable loader from our env.json file (omitted from GitLab code export due to potential leakage
|
|
* of secrets). It is usually loaded when
|
|
*/
|
|
function loadEnvFromFile() {
|
|
const fs = require('fs');
|
|
|
|
fs.access("/opt/node_modules/autocode-common/configs", (err) => {
|
|
if (err) {
|
|
fs.access('env.json', (err) => {
|
|
const env = require("../env.json")
|
|
if (!err) {
|
|
process.env["MONGO_DATABASE"] = env.dev.MONGO_DATABASE
|
|
process.env["DISCORD_GUILD_ID"] = env.dev.DISCORD_GUILD_ID,
|
|
process.env["DISCORD_ROLE_ID"] = env.dev.DISCORD_GUILD_ID
|
|
} else {
|
|
require("dotenv").config()
|
|
}
|
|
})
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
loadEnvFromFile
|
|
} |