allow a list of AppConfigs to be supplied at runtime
Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
---
|
||||
'@backstage/backend-app-api': minor
|
||||
'@backstage/config-loader': minor
|
||||
---
|
||||
|
||||
Introduces the ability to merge configs and JsonObjects
|
||||
@@ -179,7 +179,7 @@ export const lifecycleServiceFactory: () => ServiceFactory<
|
||||
export function loadBackendConfig(options: {
|
||||
remote?: LoadConfigOptionsRemote;
|
||||
argv: string[];
|
||||
additionalConfig?: AppConfig;
|
||||
additionalConfigs?: AppConfig[];
|
||||
}): Promise<{
|
||||
config: Config;
|
||||
}>;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { ConfigService } from '@backstage/backend-plugin-api';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import type { JsonValue } from '@backstage/types';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
|
||||
export class ObservableConfigProxy implements ConfigService {
|
||||
private config: ConfigService = new ConfigReader({});
|
||||
|
||||
@@ -71,7 +71,7 @@ export async function createConfigSecretEnumerator(options: {
|
||||
export async function loadBackendConfig(options: {
|
||||
remote?: LoadConfigOptionsRemote;
|
||||
argv: string[];
|
||||
additionalConfig?: AppConfig;
|
||||
additionalConfigs?: AppConfig[];
|
||||
}): Promise<{ config: Config }> {
|
||||
const args = parseArgs(options.argv);
|
||||
|
||||
@@ -115,11 +115,9 @@ export async function loadBackendConfig(options: {
|
||||
`Loaded config from ${appConfigs.map(c => c.context).join(', ')}`,
|
||||
);
|
||||
|
||||
// add the additional config if provided
|
||||
if (options.additionalConfig) {
|
||||
appConfigs.push(options.additionalConfig);
|
||||
if (options.additionalConfigs) {
|
||||
appConfigs.push(...options.additionalConfigs);
|
||||
}
|
||||
|
||||
config.setConfig(ConfigReader.fromConfigs(appConfigs));
|
||||
|
||||
return { config };
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="webpack-env" />
|
||||
|
||||
import { AppConfig } from '@backstage/config';
|
||||
import { AwsCredentialsManager } from '@backstage/integration-aws-node';
|
||||
import type { AppConfig } from '@backstage/config';
|
||||
import aws from 'aws-sdk';
|
||||
import { AwsS3Integration } from '@backstage/integration';
|
||||
import { AzureIntegration } from '@backstage/integration';
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
loadBackendConfig as newLoadBackendConfig,
|
||||
} from '@backstage/backend-app-api';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import type { AppConfig, Config } from '@backstage/config';
|
||||
import { AppConfig, Config } from '@backstage/config';
|
||||
import { LoadConfigOptionsRemote } from '@backstage/config-loader';
|
||||
import { setRootLoggerRedactionList } from './logging/createRootLogger';
|
||||
|
||||
|
||||
@@ -139,11 +139,8 @@ export async function loadConfig(
|
||||
|
||||
const env = envFunc ?? (async (name: string) => process.env[name]);
|
||||
|
||||
const loadConfigFiles = async (): Promise<{
|
||||
fileConfigs: AppConfig[];
|
||||
loadedPaths: Set<string>;
|
||||
}> => {
|
||||
const fileConfigs: AppConfig[] = [];
|
||||
const loadConfigFiles = async () => {
|
||||
const fileConfigs = [];
|
||||
const loadedPaths = new Set<string>();
|
||||
|
||||
for (const configPath of configPaths) {
|
||||
@@ -179,7 +176,7 @@ export async function loadConfig(
|
||||
return { fileConfigs, loadedPaths };
|
||||
};
|
||||
|
||||
const loadRemoteConfigFiles = async (): Promise<AppConfig[]> => {
|
||||
const loadRemoteConfigFiles = async () => {
|
||||
const configs: AppConfig[] = [];
|
||||
|
||||
const readConfigFromUrl = async (url: string) => {
|
||||
|
||||
Reference in New Issue
Block a user