templates-mo
Version:
Templates is a scaffolding framework that makes code generation simple, dynamic, and reusable. Generate files, parts of your app, or whole project structures—without the repetitive copy-pasting
25 lines (24 loc) • 855 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.middleware = void 0;
const dotenvx_1 = __importDefault(require("@dotenvx/dotenvx"));
const find_up_1 = __importDefault(require("find-up"));
const constants_1 = require("../../utilities/constants");
/**
* Load env variables from a env file. Will search up the file system tree until
* it finds one or does nothing
*/
const loadEnv = (args) => {
if (args.env) {
const envPath = find_up_1.default.sync('.env', { cwd: constants_1.CWD });
dotenvx_1.default.config({
path: envPath,
quiet: true,
ignore: ['MISSING_ENV_FILE'],
});
}
};
exports.middleware = [loadEnv];