diff --git a/docker-compose.yml b/docker-compose.yml index 4b268d5..24ba32b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,6 +74,7 @@ services: - APP_BASE_URL=${APP_BASE_URL:-} - HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-30000} - DEBUG=${TG_BOT_DEBUG:-} + - PUBLIC_API_URL=${PUBLIC_API_URL:-} depends_on: couchdb: condition: service_healthy diff --git a/services/tg-bot/src/config/env.ts b/services/tg-bot/src/config/env.ts index d473b4b..49db64d 100644 --- a/services/tg-bot/src/config/env.ts +++ b/services/tg-bot/src/config/env.ts @@ -14,10 +14,6 @@ if (!process.env.API_URL) { throw new Error("Environment variable API_URL is not set"); } -if (!process.env.PUBLIC_API_URL) { - throw new Error("Environment variable PUBLIC_API_URL is not set"); -} - if (!process.env.HEARTBEAT_INTERVAL) { throw new Error("Environment variable HEARTBEAT_INTERVAL is not set"); } @@ -27,6 +23,7 @@ export const env = { READ_BASE_URL: process.env.READ_BASE_URL, APP_BASE_URL: process.env.APP_BASE_URL, API_URL: process.env.API_URL, - PUBLIC_API_URL: process.env.PUBLIC_API_URL, + PUBLIC_API_URL: + process.env.PUBLIC_API_URL || `${process.env.APP_BASE_URL}/api`, HEARTBEAT_INTERVAL: parseInt(process.env.HEARTBEAT_INTERVAL, 10), } as const;