public_url_file in .env causes server start error (#15898)

* allow *_FILE environment vars to overwrite default values

* added test

* added mock for fs

* removed test
This commit is contained in:
Brainslug
2022-10-11 22:47:33 +02:00
committed by GitHub
parent b28633d597
commit 3c2125f646
2 changed files with 2 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ describe('env processed values', () => {
afterEach(() => {
process.env = originalEnv;
jest.resetAllMocks();
});
test('Number value should be a number', () => {

View File

@@ -401,7 +401,7 @@ function processValues(env: Record<string, any>) {
if (key.length > 5 && key.endsWith('_FILE')) {
newKey = key.slice(0, -5);
if (allowedEnvironmentVars.some((pattern) => pattern.test(newKey as string))) {
if (newKey in env) {
if (newKey in env && !(newKey in defaults && env[newKey] === defaults[newKey])) {
throw new Error(
`Duplicate environment variable encountered: you can't use "${newKey}" and "${key}" simultaneously.`
);