From 58eeff700174f349fea70de2580b8d1ce4482684 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 12 Jun 2022 17:51:26 +0200 Subject: [PATCH] Feature/expose the environment variable host (#1007) * Expose environment variable: HOST * Update changelog --- .env | 1 - CHANGELOG.md | 1 + apps/api/src/main.ts | 5 +++-- apps/api/src/services/configuration.service.ts | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 44c1ec3a..4f6dc7cd 100644 --- a/.env +++ b/.env @@ -14,4 +14,3 @@ ACCESS_TOKEN_SALT= ALPHA_VANTAGE_API_KEY= DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?sslmode=prefer JWT_SECRET_KEY= -PORT=3333 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3336b81b..34a18190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Exposed the environment variable `HOST` - Decreased the number of attempts of queue jobs from `20` to `10` (fail earlier) - Improved the message for data provider errors in the client - Changed the label from _Balance_ to _Cash Balance_ in the account dialog diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index cf565a36..546cbbf3 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -20,10 +20,11 @@ async function bootstrap() { }) ); + const host = process.env.HOST || 'localhost'; const port = process.env.PORT || 3333; - await app.listen(port, () => { + await app.listen(port, host, () => { logLogo(); - Logger.log(`Listening at http://localhost:${port}`); + Logger.log(`Listening at http://${host}:${port}`); Logger.log(''); }); } diff --git a/apps/api/src/services/configuration.service.ts b/apps/api/src/services/configuration.service.ts index 525951a7..cc80c146 100644 --- a/apps/api/src/services/configuration.service.ts +++ b/apps/api/src/services/configuration.service.ts @@ -31,12 +31,13 @@ export class ConfigurationService { GOOGLE_SHEETS_ACCOUNT: str({ default: '' }), GOOGLE_SHEETS_ID: str({ default: '' }), GOOGLE_SHEETS_PRIVATE_KEY: str({ default: '' }), + HOST: host({ default: 'localhost' }), JWT_SECRET_KEY: str({}), MAX_ITEM_IN_CACHE: num({ default: 9999 }), MAX_ORDERS_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }), PORT: port({ default: 3333 }), RAKUTEN_RAPID_API_KEY: str({ default: '' }), - REDIS_HOST: str({ default: 'localhost' }), + REDIS_HOST: host({ default: 'localhost' }), REDIS_PASSWORD: str({ default: '' }), REDIS_PORT: port({ default: 6379 }), ROOT_URL: str({ default: 'http://localhost:4200' }),