mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix "Duplicate environment variable" error message never showing up (#6740)
This commit is contained in:
@@ -181,14 +181,14 @@ function processValues(env: Record<string, any>) {
|
||||
// and store it in the variable with the same name but without '_FILE' at the end
|
||||
let newKey;
|
||||
if (key.length > 5 && key.endsWith('_FILE')) {
|
||||
newKey = key.slice(0, -5);
|
||||
if (newKey in env) {
|
||||
throw new Error(
|
||||
`Duplicate environment variable encountered: you can't use "${newKey}" and "${key}" simultaneously.`
|
||||
);
|
||||
}
|
||||
try {
|
||||
value = fs.readFileSync(value, { encoding: 'utf8' });
|
||||
newKey = key.slice(0, -5);
|
||||
if (newKey in env) {
|
||||
throw new Error(
|
||||
`Duplicate environment variable encountered: you can't use "${key}" and "${newKey}" simultaneously.`
|
||||
);
|
||||
}
|
||||
key = newKey;
|
||||
} catch {
|
||||
throw new Error(`Failed to read value from file "${value}", defined in environment variable "${key}".`);
|
||||
|
||||
Reference in New Issue
Block a user