diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 38a110b8..acd2321b 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -9,6 +9,7 @@ type AppConfig = { webAppUrl: string; webhookUrl: string; appEnv: string; + logLevel: string; isDev: boolean; isProd: boolean; postgresDatabase: string; @@ -80,6 +81,7 @@ const appConfig: AppConfig = { protocol, port, appEnv: appEnv, + logLevel: process.env.LOG_LEVEL || 'info', isDev: appEnv === 'development', isProd: appEnv === 'production', version: process.env.npm_package_version, diff --git a/packages/backend/src/helpers/logger.ts b/packages/backend/src/helpers/logger.ts index 7fd1a3cc..e5c9ee82 100644 --- a/packages/backend/src/helpers/logger.ts +++ b/packages/backend/src/helpers/logger.ts @@ -9,10 +9,6 @@ const levels = { debug: 4, }; -const level = () => { - return appConfig.appEnv === 'development' ? 'debug' : 'info'; -}; - const colors = { error: 'red', warn: 'yellow', @@ -41,7 +37,7 @@ const transports = [ ]; export const logger = winston.createLogger({ - level: level(), + level: appConfig.logLevel, levels, format, transports, diff --git a/packages/docs/pages/advanced/configuration.md b/packages/docs/pages/advanced/configuration.md index da4f4580..9befd08f 100644 --- a/packages/docs/pages/advanced/configuration.md +++ b/packages/docs/pages/advanced/configuration.md @@ -14,30 +14,31 @@ The default values for some environment variables might be different in our deve Please be careful with the `ENCRYPTION_KEY` and `WEBHOOK_SECRET_KEY` environment variables. They are used to encrypt your credentials from third-party services and verify webhook requests. If you change them, your existing connections and flows will not continue to work. ::: -| Variable Name | Type | Default Value | Description | -| --------------------------- | ------- | ------------------ | ---------------------------------------------------- | -| `HOST` | string | `localhost` | HTTP Host | -| `PROTOCOL` | string | `http` | HTTP Protocol | -| `PORT` | string | `3000` | HTTP Port | -| `APP_ENV` | string | `production` | Automatisch Environment | -| `WEB_APP_URL` | string | | Can be used to override connection URLs and CORS URL | -| `WEBHOOK_URL` | string | | Can be used to override webhook URL | -| `POSTGRES_DATABASE` | string | `automatisch` | Database Name | -| `POSTGRES_SCHEMA` | string | `public` | Database Schema | -| `POSTGRES_PORT` | number | `5432` | Database Port | -| `POSTGRES_ENABLE_SSL` | boolean | `false` | Enable/Disable SSL for the database | -| `POSTGRES_HOST` | string | `postgres` | Database Host | -| `POSTGRES_USERNAME` | string | `automatisch_user` | Database User | -| `POSTGRES_PASSWORD` | string | | Password of Database User | -| `ENCRYPTION_KEY` | string | | Encryption Key to store credentials | -| `WEBHOOK_SECRET_KEY` | string | | Webhook Secret Key to verify webhook requests | -| `APP_SECRET_KEY` | string | | Secret Key to authenticate the user | -| `REDIS_HOST` | string | `redis` | Redis Host | -| `REDIS_PORT` | number | `6379` | Redis Port | -| `REDIS_USERNAME` | string | | Redis Username | -| `REDIS_PASSWORD` | string | | Redis Password | -| `REDIS_TLS` | boolean | `false` | Redis TLS | -| `TELEMETRY_ENABLED` | boolean | `true` | Enable/Disable Telemetry | -| `ENABLE_BULLMQ_DASHBOARD` | boolean | `false` | Enable BullMQ Dashboard | -| `BULLMQ_DASHBOARD_USERNAME` | string | | Username to login BullMQ Dashboard | -| `BULLMQ_DASHBOARD_PASSWORD` | string | | Password to login BullMQ Dashboard | +| Variable Name | Type | Default Value | Description | +| --------------------------- | ------- | ------------------ | ---------------------------------------------------------------------------------------------------- | +| `HOST` | string | `localhost` | HTTP Host | +| `PROTOCOL` | string | `http` | HTTP Protocol | +| `PORT` | string | `3000` | HTTP Port | +| `APP_ENV` | string | `production` | Automatisch Environment | +| `WEB_APP_URL` | string | | Can be used to override connection URLs and CORS URL | +| `WEBHOOK_URL` | string | | Can be used to override webhook URL | +| `LOG_LEVEL` | string | `info` | Can be used to configure log level such as `error`, `warn`, `info`, `http`, `debug` | +| `POSTGRES_DATABASE` | string | `automatisch` | Database Name | +| `POSTGRES_SCHEMA` | string | `public` | Database Schema | +| `POSTGRES_PORT` | number | `5432` | Database Port | +| `POSTGRES_ENABLE_SSL` | boolean | `false` | Enable/Disable SSL for the database | +| `POSTGRES_HOST` | string | `postgres` | Database Host | +| `POSTGRES_USERNAME` | string | `automatisch_user` | Database User | +| `POSTGRES_PASSWORD` | string | | Password of Database User | +| `ENCRYPTION_KEY` | string | | Encryption Key to store credentials | +| `WEBHOOK_SECRET_KEY` | string | | Webhook Secret Key to verify webhook requests | +| `APP_SECRET_KEY` | string | | Secret Key to authenticate the user | +| `REDIS_HOST` | string | `redis` | Redis Host | +| `REDIS_PORT` | number | `6379` | Redis Port | +| `REDIS_USERNAME` | string | | Redis Username | +| `REDIS_PASSWORD` | string | | Redis Password | +| `REDIS_TLS` | boolean | `false` | Redis TLS | +| `TELEMETRY_ENABLED` | boolean | `true` | Enable/Disable Telemetry | +| `ENABLE_BULLMQ_DASHBOARD` | boolean | `false` | Enable BullMQ Dashboard | +| `BULLMQ_DASHBOARD_USERNAME` | string | | Username to login BullMQ Dashboard | +| `BULLMQ_DASHBOARD_PASSWORD` | string | | Password to login BullMQ Dashboard |