Read config from remote config server

Signed-off-by: Matto <muhamadto@gmail.com>
This commit is contained in:
Matto
2021-09-27 23:41:24 +10:00
parent 18d73ecc9d
commit 5d4053c827
12 changed files with 475 additions and 52 deletions
+6
View File
@@ -29,10 +29,16 @@
},
"dependencies": {
"@backstage/cli-common": "^0.1.4",
"@babel/core": "^7.4.4",
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
"@backstage/cli-common": "^0.1.3",
"@backstage/integration": "^0.6.5",
"@backstage/config": "^0.1.10",
"@backstage/config-loader": "^0.7.0",
"@backstage/errors": "^0.1.3",
"@backstage/types": "^0.1.1",
"@backstage/config-loader": "^0.6.8",
"@backstage/backend-common": "^0.9.4",
"@hot-loader/react-dom": "^16.13.0",
"@lerna/package-graph": "^4.0.0",
"@lerna/project": "^4.0.0",
+13 -3
View File
@@ -14,9 +14,14 @@
* limitations under the License.
*/
import { loadConfig, loadConfigSchema } from '@backstage/config-loader';
import {
ConfigTarget,
loadConfig,
loadConfigSchema,
} from '@backstage/config-loader';
import { ConfigReader } from '@backstage/config';
import { paths } from './paths';
import { isValidUrl } from '@backstage/integration';
type Options = {
args: string[];
@@ -26,7 +31,12 @@ type Options = {
};
export async function loadCliConfig(options: Options) {
const configPaths = options.args.map(arg => paths.resolveTarget(arg));
const configTargets: ConfigTarget[] = [];
options.args.forEach(arg => {
if (!isValidUrl(arg)) {
configTargets.push({ path: paths.resolveTarget(arg) });
}
});
// Consider all packages in the monorepo when loading in config
const { Project } = require('@lerna/project');
@@ -48,7 +58,7 @@ export async function loadCliConfig(options: Options) {
? async name => process.env[name] || 'x'
: undefined,
configRoot: paths.targetRoot,
configPaths,
configTargets: configTargets,
});
// printing to stderr to not clobber stdout in case the cli command