cli: fix for config:check only validating frontend config

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-11-10 14:57:56 +01:00
parent 12eaaaba28
commit b393c4d4be
6 changed files with 14 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Fixed the `config:check` command that was incorrectly only validating frontend configuration. Also added a `--frontend` flag to the command which maintains that behavior.
+2 -1
View File
@@ -512,7 +512,8 @@ Usage: backstage-cli config:check [options]
Options:
--package &lt;name&gt; Only load config schema that applies to the given package
--lax Do not require environment variables to be set
--lax Do not require environment variables to be set
--frontend Only validate the frontend configuration
--config &lt;path&gt; Config files to load instead of app-config.yaml (default: [])
-h, --help display help for command
```
@@ -25,6 +25,7 @@ export default async (cmd: Command) => {
args: cmd.config,
fromPackage: cmd.package,
mockEnv: cmd.lax,
fullVisibility: !cmd.frontend,
});
const visibility = getVisibilityOption(cmd);
const data = serializeConfigData(appConfigs, schema, visibility);
@@ -22,5 +22,6 @@ export default async (cmd: Command) => {
args: cmd.config,
fromPackage: cmd.package,
mockEnv: cmd.lax,
fullVisibility: !cmd.frontend,
});
};
+1
View File
@@ -172,6 +172,7 @@ export function registerCommands(program: CommanderStatic) {
'Only load config schema that applies to the given package',
)
.option('--lax', 'Do not require environment variables to be set')
.option('--frontend', 'Only validate the frontend configuration')
.option(...configOption)
.description(
'Validate that the given configuration loads and matches schema',
+4 -1
View File
@@ -28,6 +28,7 @@ type Options = {
fromPackage?: string;
mockEnv?: boolean;
withFilteredKeys?: boolean;
fullVisibility?: boolean;
};
export async function loadCliConfig(options: Options) {
@@ -70,7 +71,9 @@ export async function loadCliConfig(options: Options) {
try {
const frontendAppConfigs = schema.process(appConfigs, {
visibility: ['frontend'],
visibility: options.fullVisibility
? ['frontend', 'backend', 'secret']
: ['frontend'],
withFilteredKeys: options.withFilteredKeys,
});
const frontendConfig = ConfigReader.fromConfigs(frontendAppConfigs);