mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -08:00
fix(core): Fix env file config loading (no-changelog) (#5339)
* fix(core): Do not trim config values read from files (no-changelog) * do not use config.load. it does not work
This commit is contained in:
parent
e58bc41d24
commit
93a2dac063
|
@ -44,8 +44,7 @@ if (!inE2ETests && !inTest) {
|
|||
}
|
||||
|
||||
// Overwrite config from files defined in "_FILE" environment variables
|
||||
const overwrites = Object.entries(process.env).reduce<Record<string, string>>(
|
||||
(acc, [envName, fileName]) => {
|
||||
Object.entries(process.env).forEach(([envName, fileName]) => {
|
||||
if (envName.endsWith('_FILE') && fileName) {
|
||||
const configEnvName = envName.replace(/_FILE$/, '');
|
||||
// @ts-ignore
|
||||
|
@ -54,7 +53,7 @@ if (!inE2ETests && !inTest) {
|
|||
if (key) {
|
||||
let value: string;
|
||||
try {
|
||||
value = readFileSync(fileName, 'utf8').trim();
|
||||
value = readFileSync(fileName, 'utf8');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
if (error.code === 'ENOENT') {
|
||||
|
@ -62,15 +61,10 @@ if (!inE2ETests && !inTest) {
|
|||
}
|
||||
throw error;
|
||||
}
|
||||
console.debug('Loading config overwrite', { fileName });
|
||||
acc[key] = value;
|
||||
config.set(key, value);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
config.load(overwrites);
|
||||
});
|
||||
}
|
||||
|
||||
config.validate({
|
||||
|
|
Loading…
Reference in a new issue