Merge remote-tracking branch 'origin' into migrate-to-msw
* origin: fix: ts fix: forwardRef to SidebarItem fix(cli): one more await in the test backend-common: make loadBackendConfig return config directly and log all resolved app-configs
This commit is contained in:
@@ -15,12 +15,18 @@
|
||||
*/
|
||||
|
||||
import { findPaths } from '@backstage/cli-common';
|
||||
import { Config, ConfigReader } from '@backstage/config';
|
||||
import { loadConfig } from '@backstage/config-loader';
|
||||
import { Logger } from 'winston';
|
||||
|
||||
type Options = {
|
||||
logger: Logger;
|
||||
};
|
||||
|
||||
/**
|
||||
* Load configuration for a Backend
|
||||
*/
|
||||
export async function loadBackendConfig() {
|
||||
export async function loadBackendConfig(options: Options): Promise<Config> {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
const paths = findPaths(__dirname);
|
||||
const configs = await loadConfig({
|
||||
@@ -28,5 +34,10 @@ export async function loadBackendConfig() {
|
||||
rootPaths: [paths.targetRoot, paths.targetDir],
|
||||
shouldReadSecrets: true,
|
||||
});
|
||||
return configs;
|
||||
|
||||
options.logger.info(
|
||||
`Loaded config from ${configs.map(c => c.context).join(', ')}`,
|
||||
);
|
||||
|
||||
return ConfigReader.fromConfigs(configs);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { Config } from '@backstage/config';
|
||||
import compression from 'compression';
|
||||
import cors from 'cors';
|
||||
import express, { Router } from 'express';
|
||||
@@ -77,7 +77,7 @@ export class ServiceBuilderImpl implements ServiceBuilder {
|
||||
this.module = moduleRef;
|
||||
}
|
||||
|
||||
loadConfig(config: ConfigReader): ServiceBuilder {
|
||||
loadConfig(config: Config): ServiceBuilder {
|
||||
const backendConfig = config.getOptionalConfig('backend');
|
||||
if (!backendConfig) {
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user