cli: add --lax option to config:check which assumes that all env vars are set
This commit is contained in:
@@ -24,6 +24,7 @@ export default async (cmd: Command) => {
|
||||
const { schema, appConfigs } = await loadCliConfig({
|
||||
args: cmd.config,
|
||||
fromPackage: cmd.package,
|
||||
mockEnv: cmd.lax,
|
||||
});
|
||||
const visibility = getVisibilityOption(cmd);
|
||||
const data = serializeConfigData(appConfigs, schema, visibility);
|
||||
|
||||
@@ -21,5 +21,6 @@ export default async (cmd: Command) => {
|
||||
await loadCliConfig({
|
||||
args: cmd.config,
|
||||
fromPackage: cmd.package,
|
||||
mockEnv: cmd.lax,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -153,6 +153,7 @@ export function registerCommands(program: CommanderStatic) {
|
||||
'--package <name>',
|
||||
'Only load config schema that applies to the given package',
|
||||
)
|
||||
.option('--lax', 'Do not require environment variables to be set')
|
||||
.option('--frontend', 'Print only the frontend configuration')
|
||||
.option('--with-secrets', 'Include secrets in the printed configuration')
|
||||
.option(
|
||||
@@ -169,6 +170,7 @@ export function registerCommands(program: CommanderStatic) {
|
||||
'--package <name>',
|
||||
'Only load config schema that applies to the given package',
|
||||
)
|
||||
.option('--lax', 'Do not require environment variables to be set')
|
||||
.option(...configOption)
|
||||
.description(
|
||||
'Validate that the given configuration loads and matches schema',
|
||||
|
||||
@@ -21,6 +21,7 @@ import { paths } from './paths';
|
||||
type Options = {
|
||||
args: string[];
|
||||
fromPackage?: string;
|
||||
mockEnv?: boolean;
|
||||
};
|
||||
|
||||
export async function loadCliConfig(options: Options) {
|
||||
@@ -40,7 +41,9 @@ export async function loadCliConfig(options: Options) {
|
||||
});
|
||||
|
||||
const appConfigs = await loadConfig({
|
||||
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'production',
|
||||
experimentalEnvFunc: options.mockEnv
|
||||
? async name => process.env[name] || 'x'
|
||||
: undefined,
|
||||
configRoot: paths.targetRoot,
|
||||
configPaths,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user