@grouparoo/core
Version:
The Grouparoo Core
29 lines (28 loc) • 1.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const pluginDetails_1 = require("../modules/pluginDetails");
const envFileAttempts = [];
// suppress long stack traces for customer-facing errors
if (!process.env.ACTIONHERO_FATAL_ERROR_STACK_DISPLAY) {
process.env.ACTIONHERO_FATAL_ERROR_STACK_DISPLAY = "false";
}
if (process.env.GROUPAROO_ENV_CONFIG_FILE) {
envFileAttempts.unshift(process.env.GROUPAROO_ENV_CONFIG_FILE);
envFileAttempts.unshift(path_1.default.join((0, pluginDetails_1.getParentPath)(), process.env.GROUPAROO_ENV_CONFIG_FILE));
}
else {
envFileAttempts.push(path_1.default.resolve(path_1.default.join((0, pluginDetails_1.getParentPath)(), ".env")));
}
let found = false;
envFileAttempts.forEach((file) => {
if (!found && fs_1.default.existsSync(file)) {
require("dotenv").config({ path: file });
process.env.GROUPAROO_ENV_CONFIG_FILE = file;
found = true;
}
});