chore: Use web app url instead of cors protocol, port and host

This commit is contained in:
Faruk AYDIN
2021-11-23 11:16:57 +01:00
committed by Ali BARIN
parent f8e823545a
commit 77ab83b43b
2 changed files with 3 additions and 10 deletions

View File

@@ -5,8 +5,7 @@ type AppConfig = {
host: string,
protocol: string
port: string,
corsPort: string,
corsProtocol: string,
webAppUrl: string,
appEnv: string,
postgresDatabase: string,
postgresPort: number,
@@ -14,15 +13,13 @@ type AppConfig = {
postgresUsername: string,
postgresPassword: string,
baseUrl?: string
webAppUrl?: string
}
const appConfig: AppConfig = {
host: process.env.HOST || 'localhost',
protocol: process.env.PROTOCOL || 'http',
port: process.env.PORT || '3000',
corsPort: process.env.CORS_PORT || '3001',
corsProtocol: process.env.CORS_PROTOCOL || 'http',
webAppUrl: process.env.webAppUrl || 'https://localhost:3001',
appEnv: process.env.APP_ENV || 'development',
postgresDatabase: process.env.POSTGRES_DATABASE || 'automatisch_development',
postgresPort: parseInt(process.env.POSTGRES_PORT) || 5432,
@@ -31,9 +28,6 @@ const appConfig: AppConfig = {
postgresPassword: process.env.POSTGRESS_PASSWORD,
}
const webAppUrl = `${appConfig.corsProtocol}://${appConfig.host}:${appConfig.corsPort}`;
appConfig.webAppUrl = webAppUrl;
const baseUrl = `${appConfig.protocol}://${appConfig.host}:${appConfig.port}`;
appConfig.baseUrl = baseUrl;