mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
18 lines
488 B
TypeScript
18 lines
488 B
TypeScript
import { set } from 'lodash-es';
|
|
|
|
import { type AFFiNEConfig, parseEnvValue } from './def';
|
|
|
|
export function applyEnvToConfig(rawConfig: AFFiNEConfig) {
|
|
for (const env in rawConfig.ENV_MAP) {
|
|
const config = rawConfig.ENV_MAP[env];
|
|
const [path, value] =
|
|
typeof config === 'string'
|
|
? [config, process.env[env]]
|
|
: [config[0], parseEnvValue(process.env[env], config[1])];
|
|
|
|
if (typeof value !== 'undefined') {
|
|
set(rawConfig, path, value);
|
|
}
|
|
}
|
|
}
|