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:
blam
2020-10-21 13:57:40 +02:00
20 changed files with 160 additions and 88 deletions
+13 -2
View File
@@ -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;