MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / loadEnvFile

Function loadEnvFile

packages/hydrooj/src/options.ts:8–14  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

6const logger = new Logger('options');
7
8function loadEnvFile(file: string) {
9 const content = fs.readFileSync(file).toString().replace(/\r/g, '');
10 for (const line of content.split('\n')) {
11 if (!line.includes('=')) continue;
12 process.env[line.split('=')[0]] = line.split('=')[1].trim();
13 }
14}
15
16const profile = process.env.HYDRO_PROFILE;
17export const hydroPath = profile ? path.resolve(os.homedir(), '.hydro', 'profiles', profile) : path.resolve(os.homedir(), '.hydro');

Callers 1

loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected