chore: change to BACKSTAGE_ENV
as per review Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/config-loader': patch
|
||||
---
|
||||
|
||||
Allow using `BACKSTAGE_ENVIRONMENT` for loading environment specific config files
|
||||
Allow using `BACKSTAGE_ENV` for loading environment specific config files
|
||||
|
||||
+4
-4
@@ -17,15 +17,15 @@ allowing for customization.
|
||||
|
||||
Configuration is stored in YAML files where the defaults are `app-config.yaml`
|
||||
and `app-config.local.yaml` for local overrides. Additionally, it is possible
|
||||
to define environment based configuration files with `BACKSTAGE_ENVIRONMENT`
|
||||
environment variable, which will load `app-config.<BACKSTAGE_ENVIRONMENT>.yaml`.
|
||||
to define environment based configuration files with `BACKSTAGE_ENV`
|
||||
environment variable, which will load `app-config.<BACKSTAGE_ENV>.yaml`.
|
||||
|
||||
Loading order of these files is as follows:
|
||||
|
||||
1. `app-config.yaml`
|
||||
2. `app-config.<BACKSTAGE_ENVIRONMENT>.yaml`
|
||||
2. `app-config.<BACKSTAGE_ENV>.yaml`
|
||||
3. `app-config.local.yaml`
|
||||
4. `app-config.<BACKSTAGE_ENVIRONMENT>.local.yaml`
|
||||
4. `app-config.<BACKSTAGE_ENV>.local.yaml`
|
||||
|
||||
Other sets of files can by loaded by passing `--config <path>` flags.
|
||||
Read more about the configuration loading order in the
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('ConfigSources', () => {
|
||||
{ name: 'FileConfigSource', path: `${root}app-config.local.yaml` },
|
||||
]);
|
||||
|
||||
process.env = Object.assign(process.env, { BACKSTAGE_ENVIRONMENT: 'test' });
|
||||
process.env = Object.assign(process.env, { BACKSTAGE_ENV: 'test' });
|
||||
expect(
|
||||
mergeSources(
|
||||
ConfigSources.defaultForTargets({ rootDir: '/', targets: [] }),
|
||||
|
||||
@@ -184,11 +184,11 @@ export class ConfigSources {
|
||||
const localPath = resolvePath(rootDir, 'app-config.local.yaml');
|
||||
const envPath = resolvePath(
|
||||
rootDir,
|
||||
`app-config.${process.env.BACKSTAGE_ENVIRONMENT}.yaml`,
|
||||
`app-config.${process.env.BACKSTAGE_ENV}.yaml`,
|
||||
);
|
||||
const envLocalPath = resolvePath(
|
||||
rootDir,
|
||||
`app-config.${process.env.BACKSTAGE_ENVIRONMENT}.local.yaml`,
|
||||
`app-config.${process.env.BACKSTAGE_ENV}.local.yaml`,
|
||||
);
|
||||
const alwaysIncludeDefaultConfigSource =
|
||||
!options.allowMissingDefaultConfig;
|
||||
@@ -203,7 +203,7 @@ export class ConfigSources {
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.BACKSTAGE_ENVIRONMENT && fs.pathExistsSync(envPath)) {
|
||||
if (process.env.BACKSTAGE_ENV && fs.pathExistsSync(envPath)) {
|
||||
argSources.push(
|
||||
FileConfigSource.create({
|
||||
watch: options.watch,
|
||||
@@ -223,10 +223,7 @@ export class ConfigSources {
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
process.env.BACKSTAGE_ENVIRONMENT &&
|
||||
fs.pathExistsSync(envLocalPath)
|
||||
) {
|
||||
if (process.env.BACKSTAGE_ENV && fs.pathExistsSync(envLocalPath)) {
|
||||
argSources.push(
|
||||
FileConfigSource.create({
|
||||
watch: options.watch,
|
||||
|
||||
Reference in New Issue
Block a user