@deepbrainspace/nx-surrealdb
Version:
NX plugin for SurrealDB migrations with modular architecture
21 lines • 759 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadEnvFile = loadEnvFile;
exports.replaceEnvVars = replaceEnvVars;
const tslib_1 = require("tslib");
const dotenv = tslib_1.__importStar(require("dotenv"));
const path = tslib_1.__importStar(require("path"));
function loadEnvFile(context, envFile) {
const envPath = path.join(context.root, envFile || '.env');
dotenv.config({ path: envPath });
}
function replaceEnvVars(content) {
return content.replace(/\${([^}]+)}/g, (match, key) => {
const value = process.env[key];
if (value === undefined) {
throw new Error(`Environment variable ${key} is not defined`);
}
return value;
});
}
//# sourceMappingURL=env.js.map