fix: ensure environment variables are loaded correctly in Docker (#49)

* feat: add reverse proxy support with configurable base path and trust proxy settings

* fix: ensure environment variables are loaded correctly in Docker

- Move dotenv config to the top of server.js
- Update docker-compose.yml to properly handle .env file
- Remove duplicate environment variables section

This ensures BASE_PATH and TRUST_PROXY work as expected in both Docker and local environments.
This commit is contained in:
M Firdaus Riawan 2025-09-06 18:30:01 +07:00 • committed by GitHub
commit 364c8fe647
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -10,6 +10,7 @@ services:
restart: always
ports:
- "3000:3000"
env_file: .env
environment:
# Core Configuration
- BASE_WEBHOOK_URL=http://localhost:3000/localCallbackExample

View file

@ -1,11 +1,12 @@
// Load environment variables first
require('dotenv').config({ path: process.env.ENV_PATH || '.env' })
const app = require('./src/app')
const { baseWebhookURL, enableWebHook, enableWebSocket, autoStartSessions } = require('./src/config')
const { logger } = require('./src/logger')
const { handleUpgrade } = require('./src/websocket')
const { restoreSessions } = require('./src/sessions')
require('dotenv').config()
// Start the server
const port = process.env.PORT || 3000