Merge pull request #4458 from backstage/rugvip/appconfigdisable
app-backend: added disableConfigInjection option + docs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-app-backend': patch
|
||||
---
|
||||
|
||||
Added a new `disableConfigInjection` option, which can be used to disable the configuration injection in environments where it can't be used.
|
||||
@@ -26,8 +26,34 @@ import fs from 'fs-extra';
|
||||
export interface RouterOptions {
|
||||
config: Config;
|
||||
logger: Logger;
|
||||
|
||||
/**
|
||||
* The name of the app package that content should be served from. The same app package should be
|
||||
* added as a dependency to the backend package in order for it to be accessible at runtime.
|
||||
*
|
||||
* In a typical setup with a single app package this would be set to 'app'.
|
||||
*/
|
||||
appPackageName: string;
|
||||
|
||||
/**
|
||||
* A request handler to handle requests for static content that are not present in the app bundle.
|
||||
*
|
||||
* This can be used to avoid issues with clients on older deployment versions trying to access lazy
|
||||
* loaded content that is no longer present. Typically the requests would fall back to a long-term
|
||||
* object store where all recently deployed versions of the app are present.
|
||||
*/
|
||||
staticFallbackHandler?: express.Handler;
|
||||
|
||||
/**
|
||||
* Disables the configuration injection. This can be useful if you're running in an environment
|
||||
* with a read-only filesystem, or for some other reason don't want configuration to be injected.
|
||||
*
|
||||
* Note that this will cause the configuration used when building the app bundle to be used, unless
|
||||
* a separate configuration loading strategy is set up.
|
||||
*
|
||||
* This also disables configuration injection though `APP_CONFIG_` environment variables.
|
||||
*/
|
||||
disableConfigInjection?: boolean;
|
||||
}
|
||||
|
||||
export async function createRouter(
|
||||
@@ -48,13 +74,15 @@ export async function createRouter(
|
||||
|
||||
logger.info(`Serving static app content from ${appDistDir}`);
|
||||
|
||||
const appConfigs = await readConfigs({
|
||||
config,
|
||||
appDistDir,
|
||||
env: process.env,
|
||||
});
|
||||
if (!options.disableConfigInjection) {
|
||||
const appConfigs = await readConfigs({
|
||||
config,
|
||||
appDistDir,
|
||||
env: process.env,
|
||||
});
|
||||
|
||||
await injectConfig({ appConfigs, logger, staticDir });
|
||||
await injectConfig({ appConfigs, logger, staticDir });
|
||||
}
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user