cli: allow running with no configuration files
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
@@ -48,8 +48,12 @@ const BUILD_CACHE_ENV_VAR = 'BACKSTAGE_CLI_EXPERIMENTAL_BUILD_CACHE';
|
||||
|
||||
export function resolveBaseUrl(config: Config): URL {
|
||||
const baseUrl = config.getOptionalString('app.baseUrl');
|
||||
|
||||
try {
|
||||
return new URL(baseUrl ?? '/', 'http://localhost:3000');
|
||||
return new URL(
|
||||
baseUrl ?? '/',
|
||||
`http://localhost:${process.env.PORT ?? '3000'}`,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(`Invalid app.baseUrl, ${error}`);
|
||||
}
|
||||
|
||||
@@ -96,11 +96,13 @@ export async function loadCliConfig(options: Options) {
|
||||
},
|
||||
});
|
||||
|
||||
const configurationLoadedMessage = appConfigs.length
|
||||
? `Loaded config from ${appConfigs.map(c => c.context).join(', ')}`
|
||||
: `No configuration files found, running without config`;
|
||||
|
||||
// printing to stderr to not clobber stdout in case the cli command
|
||||
// outputs structured data (e.g. as config:schema does)
|
||||
process.stderr.write(
|
||||
`Loaded config from ${appConfigs.map(c => c.context).join(', ')}\n`,
|
||||
);
|
||||
process.stderr.write(`${configurationLoadedMessage}\n`);
|
||||
|
||||
try {
|
||||
const frontendAppConfigs = schema.process(appConfigs, {
|
||||
|
||||
Reference in New Issue
Block a user