config-loader,backend-common: refactor config loading to pass in path and use common util for backend

This commit is contained in:
Patrik Oldsberg
2020-08-03 18:21:03 +02:00
parent aa265769d2
commit 62222b543c
20 changed files with 50 additions and 100 deletions
+2
View File
@@ -29,7 +29,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/cli-common": "^0.1.1-alpha.16",
"@backstage/config": "^0.1.1-alpha.16",
"@backstage/config-loader": "^0.1.1-alpha.16",
"@types/cors": "^2.8.6",
"@types/express": "^4.17.6",
"compression": "^1.7.4",
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { findPaths } from '@backstage/cli-common';
import { loadConfig } from '@backstage/config-loader';
/**
* Load configuration for a Backend
*/
export async function loadBackendConfig() {
const paths = findPaths(__dirname);
const configs = await loadConfig({
rootPath: paths.targetRoot,
shouldReadSecrets: true,
});
return configs;
}
+1
View File
@@ -14,6 +14,7 @@
* limitations under the License.
*/
export * from './config';
export * from './errors';
export * from './logging';
export * from './middleware';