feat(mindspace): enforce PostgreSQL user data delivery
This commit is contained in:
+7
-16
@@ -1,20 +1,11 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
function loadEnvFile(filePath) {
|
||||
if (!fs.existsSync(filePath)) return;
|
||||
for (const line of fs.readFileSync(filePath, 'utf8').split('\n')) {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed || trimmed.startsWith('#')) continue;
|
||||
const separator = trimmed.indexOf('=');
|
||||
if (separator < 0) continue;
|
||||
const key = trimmed.slice(0, separator).trim();
|
||||
const value = trimmed.slice(separator + 1).trim();
|
||||
if (!process.env[key]) process.env[key] = value;
|
||||
}
|
||||
}
|
||||
import {
|
||||
applyMemindRuntimeProfile,
|
||||
loadMemindEnvFiles,
|
||||
} from './memind-runtime-profile.mjs';
|
||||
|
||||
export function loadH5Environment(scriptDirectory) {
|
||||
loadEnvFile(path.join(scriptDirectory, '../../../.env.local'));
|
||||
loadEnvFile(path.join(scriptDirectory, '../.env'));
|
||||
const root = path.join(scriptDirectory, '..');
|
||||
loadMemindEnvFiles(root);
|
||||
applyMemindRuntimeProfile({ rootDir: root });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user