plugins/auth-backend: read backend.baseUrl from config

This commit is contained in:
Patrik Oldsberg
2020-06-17 16:54:02 +02:00
parent 64a8bd2187
commit e923d751a7
3 changed files with 10 additions and 4 deletions
+1
View File
@@ -21,6 +21,7 @@
},
"dependencies": {
"@backstage/backend-common": "^0.1.1-alpha.9",
"@backstage/config": "^0.1.1-alpha.9",
"@types/express": "^4.17.6",
"body-parser": "^1.19.0",
"compression": "^1.7.4",
+4 -2
View File
@@ -20,9 +20,11 @@ import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import { Logger } from 'winston';
import { createAuthProviderRouter } from '../providers';
import { Config } from '@backstage/config';
export interface RouterOptions {
logger: Logger;
config: Config;
}
export async function createRouter(
@@ -38,7 +40,7 @@ export async function createRouter(
// TODO: read from app config
const config = {
backend: {
baseUrl: 'http://localhost:7000',
baseUrl: options.config.getString('backend.baseUrl'),
},
auth: {
providers: {
@@ -77,7 +79,7 @@ export async function createRouter(
const providerConfigs = config.auth.providers;
for (const [providerId, providerConfig] of Object.entries(providerConfigs)) {
const baseUrl = `${config.backend.baseUrl}/auth`;
const baseUrl = `${options.config.getString('backend.baseUrl')}/auth`;
logger.info(`Configuring provider, ${providerId}`);
try {
const providerRouter = createAuthProviderRouter(