From eef0522644ed9d50fcc7fd69e7a712c2719b47ab Mon Sep 17 00:00:00 2001 From: Luka Siric Date: Tue, 30 Aug 2022 16:33:47 +0200 Subject: [PATCH] resolved @Rugvip comments Signed-off-by: Luka Siric --- app-config.yaml | 6 ---- packages/cli/config.d.ts | 40 ++++++++++++++++++++++++++ packages/cli/src/lib/bundler/server.ts | 6 ++-- packages/cli/src/lib/bundler/types.ts | 1 - packages/cli/src/lib/config.ts | 7 +---- packages/core-app-api/config.d.ts | 20 ------------- 6 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 packages/cli/config.d.ts diff --git a/app-config.yaml b/app-config.yaml index fc7215ceb8..7c93d9cbd2 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -2,12 +2,6 @@ app: title: Backstage Example App baseUrl: http://localhost:3000 googleAnalyticsTrackingId: # UA-000000-0 - # https: - # certificate: - # cert: - # $file: '\path\to\the\certificate' - # key: - # $file: '\path\to\the\private-key' #datadogRum: # clientToken: '123456789' # applicationId: qwerty diff --git a/packages/cli/config.d.ts b/packages/cli/config.d.ts new file mode 100644 index 0000000000..24cc60dac3 --- /dev/null +++ b/packages/cli/config.d.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2022 The Backstage Authors + * + * 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. + */ + +export interface Config { + app: { + /** + * Running the frontend app with https + */ + https?: { + /** + * Parent object containing certificate and the private key + */ + certificate?: { + /** + * Https Certificate private key. Use $file to load in a file + * @visibility secret + */ + key: string; + /** + * Https Certificate. Use $file to load in a file + * @visibility secret + */ + cert: string; + }; + }; + }; +} diff --git a/packages/cli/src/lib/bundler/server.ts b/packages/cli/src/lib/bundler/server.ts index a05baf5355..d3f1e8da75 100644 --- a/packages/cli/src/lib/bundler/server.ts +++ b/packages/cli/src/lib/bundler/server.ts @@ -64,12 +64,10 @@ export async function serveBundle(options: ServeOptions) { https: url.protocol === 'https:' ? { - cert: options.frontendConfig.getOptionalString( + cert: options.backendConfig.getString( 'app.https.certificate.cert', ), - key: options.backendConfig.getOptionalString( - 'app.https.certificate.key', - ), + key: options.backendConfig.getString('app.https.certificate.key'), } : false, host, diff --git a/packages/cli/src/lib/bundler/types.ts b/packages/cli/src/lib/bundler/types.ts index 0d9d0f7af4..68260735f9 100644 --- a/packages/cli/src/lib/bundler/types.ts +++ b/packages/cli/src/lib/bundler/types.ts @@ -32,7 +32,6 @@ export type ServeOptions = BundlingPathsOptions & { frontendConfig: Config; frontendAppConfigs: AppConfig[]; backendConfig: Config; - backendAppConfigs: AppConfig[]; }; export type BuildOptions = BundlingPathsOptions & { diff --git a/packages/cli/src/lib/config.ts b/packages/cli/src/lib/config.ts index 691c0ff83c..994714a3ce 100644 --- a/packages/cli/src/lib/config.ts +++ b/packages/cli/src/lib/config.ts @@ -96,11 +96,7 @@ export async function loadCliConfig(options: Options) { }); const frontendConfig = ConfigReader.fromConfigs(frontendAppConfigs); - const backendAppConfigs = schema.process(appConfigs, { - visibility: ['frontend', 'backend', 'secret'], - withFilteredKeys: options.withFilteredKeys, - withDeprecatedKeys: options.withDeprecatedKeys, - }); + const backendAppConfigs = schema.process(appConfigs); const backendConfig = ConfigReader.fromConfigs(backendAppConfigs); return { @@ -108,7 +104,6 @@ export async function loadCliConfig(options: Options) { appConfigs, frontendConfig, frontendAppConfigs, - backendAppConfigs, backendConfig, }; } catch (error) { diff --git a/packages/core-app-api/config.d.ts b/packages/core-app-api/config.d.ts index 6b707987e5..d88c818d11 100644 --- a/packages/core-app-api/config.d.ts +++ b/packages/core-app-api/config.d.ts @@ -65,26 +65,6 @@ export interface Config { }>; }>; }; - /** - * Running the frontend app with https - */ - https?: { - /** - * Parent object containing certificate and the private key - */ - certificate?: { - /** - * Https Certificate private key. Use $file to load in a file - * @visibility secret - */ - key?: string; - /** - * Https Certificate. Use $file to load in a file - * @visibility frontend - */ - cert?: string; - }; - }; }; /**