diff --git a/docs/conf/index.md b/docs/conf/index.md index 7c5be174e5..0b2240e2de 100644 --- a/docs/conf/index.md +++ b/docs/conf/index.md @@ -25,6 +25,7 @@ Loading order of these files is as follows: 1. `app-config.yaml` 2. `app-config..yaml` 3. `app-config.local.yaml` +4. `app-config..local.yaml` Other sets of files can by loaded by passing `--config ` flags. Read more about the configuration loading order in the diff --git a/packages/config-loader/src/sources/ConfigSources.test.ts b/packages/config-loader/src/sources/ConfigSources.test.ts index 9b2932e439..da56f5ccf9 100644 --- a/packages/config-loader/src/sources/ConfigSources.test.ts +++ b/packages/config-loader/src/sources/ConfigSources.test.ts @@ -99,6 +99,7 @@ describe('ConfigSources', () => { { name: 'FileConfigSource', path: `${root}app-config.yaml` }, { name: 'FileConfigSource', path: `${root}app-config.test.yaml` }, { name: 'FileConfigSource', path: `${root}app-config.local.yaml` }, + { name: 'FileConfigSource', path: `${root}app-config.test.local.yaml` }, ]); fsSpy.mockRestore(); diff --git a/packages/config-loader/src/sources/ConfigSources.ts b/packages/config-loader/src/sources/ConfigSources.ts index 0d958bb81d..1dacdc4752 100644 --- a/packages/config-loader/src/sources/ConfigSources.ts +++ b/packages/config-loader/src/sources/ConfigSources.ts @@ -186,6 +186,10 @@ export class ConfigSources { rootDir, `app-config.${process.env.BACKSTAGE_ENVIRONMENT}.yaml`, ); + const envLocalPath = resolvePath( + rootDir, + `app-config.${process.env.BACKSTAGE_ENVIRONMENT}.local.yaml`, + ); const alwaysIncludeDefaultConfigSource = !options.allowMissingDefaultConfig; @@ -218,6 +222,19 @@ export class ConfigSources { }), ); } + + if ( + process.env.BACKSTAGE_ENVIRONMENT && + fs.pathExistsSync(envLocalPath) + ) { + argSources.push( + FileConfigSource.create({ + watch: options.watch, + path: envLocalPath, + substitutionFunc: options.substitutionFunc, + }), + ); + } } return this.merge(argSources);