Merge pull request #30196 from backstage/sennyeya/fix-onPluginBoot
fix: loosen regex requirements for config keys
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/config-loader': patch
|
||||
'@backstage/config': patch
|
||||
---
|
||||
|
||||
Loosen the requirements for a key to be considered valid config.
|
||||
@@ -85,7 +85,7 @@ export class EnvConfigSource implements ConfigSource {
|
||||
const ENV_PREFIX = 'APP_CONFIG_';
|
||||
|
||||
// Update the same pattern in config package if this is changed
|
||||
const CONFIG_KEY_PART_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z][a-z0-9]*)*$/i;
|
||||
const CONFIG_KEY_PART_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/i;
|
||||
|
||||
/**
|
||||
* Read runtime configuration from the environment.
|
||||
|
||||
@@ -171,6 +171,7 @@ describe('ConfigReader', () => {
|
||||
expect(config.getOptionalString('x_x')).toBeUndefined();
|
||||
expect(config.getOptionalString('x-X')).toBeUndefined();
|
||||
expect(config.getOptionalString('x0')).toBeUndefined();
|
||||
expect(config.getOptionalString('x-2')).toBeUndefined();
|
||||
expect(config.getOptionalString('X-x2')).toBeUndefined();
|
||||
expect(config.getOptionalString('x0_x0')).toBeUndefined();
|
||||
expect(config.getOptionalString('x_x-x_x')).toBeUndefined();
|
||||
|
||||
@@ -18,7 +18,7 @@ import { JsonValue, JsonObject } from '@backstage/types';
|
||||
import { AppConfig, Config } from './types';
|
||||
|
||||
// Update the same pattern in config-loader package if this is changed
|
||||
const CONFIG_KEY_PART_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z][a-z0-9]*)*$/i;
|
||||
const CONFIG_KEY_PART_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/i;
|
||||
|
||||
function isObject(value: JsonValue | undefined): value is JsonObject {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
||||
|
||||
Reference in New Issue
Block a user