feat: add LOG_LEVEL env. var.

This commit is contained in:
Ali BARIN
2023-05-24 10:43:36 +00:00
parent 9701c98af9
commit 4f46c55c85
3 changed files with 31 additions and 32 deletions

View File

@@ -9,6 +9,7 @@ type AppConfig = {
webAppUrl: string; webAppUrl: string;
webhookUrl: string; webhookUrl: string;
appEnv: string; appEnv: string;
logLevel: string;
isDev: boolean; isDev: boolean;
isProd: boolean; isProd: boolean;
postgresDatabase: string; postgresDatabase: string;
@@ -80,6 +81,7 @@ const appConfig: AppConfig = {
protocol, protocol,
port, port,
appEnv: appEnv, appEnv: appEnv,
logLevel: process.env.LOG_LEVEL || 'info',
isDev: appEnv === 'development', isDev: appEnv === 'development',
isProd: appEnv === 'production', isProd: appEnv === 'production',
version: process.env.npm_package_version, version: process.env.npm_package_version,

View File

@@ -9,10 +9,6 @@ const levels = {
debug: 4, debug: 4,
}; };
const level = () => {
return appConfig.appEnv === 'development' ? 'debug' : 'info';
};
const colors = { const colors = {
error: 'red', error: 'red',
warn: 'yellow', warn: 'yellow',
@@ -41,7 +37,7 @@ const transports = [
]; ];
export const logger = winston.createLogger({ export const logger = winston.createLogger({
level: level(), level: appConfig.logLevel,
levels, levels,
format, format,
transports, transports,

View File

@@ -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. 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 | | Variable Name | Type | Default Value | Description |
| --------------------------- | ------- | ------------------ | ---------------------------------------------------- | | --------------------------- | ------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
| `HOST` | string | `localhost` | HTTP Host | | `HOST` | string | `localhost` | HTTP Host |
| `PROTOCOL` | string | `http` | HTTP Protocol | | `PROTOCOL` | string | `http` | HTTP Protocol |
| `PORT` | string | `3000` | HTTP Port | | `PORT` | string | `3000` | HTTP Port |
| `APP_ENV` | string | `production` | Automatisch Environment | | `APP_ENV` | string | `production` | Automatisch Environment |
| `WEB_APP_URL` | string | | Can be used to override connection URLs and CORS URL | | `WEB_APP_URL` | string | | Can be used to override connection URLs and CORS URL |
| `WEBHOOK_URL` | string | | Can be used to override webhook URL | | `WEBHOOK_URL` | string | | Can be used to override webhook URL |
| `POSTGRES_DATABASE` | string | `automatisch` | Database Name | | `LOG_LEVEL` | string | `info` | Can be used to configure log level such as `error`, `warn`, `info`, `http`, `debug` |
| `POSTGRES_SCHEMA` | string | `public` | Database Schema | | `POSTGRES_DATABASE` | string | `automatisch` | Database Name |
| `POSTGRES_PORT` | number | `5432` | Database Port | | `POSTGRES_SCHEMA` | string | `public` | Database Schema |
| `POSTGRES_ENABLE_SSL` | boolean | `false` | Enable/Disable SSL for the database | | `POSTGRES_PORT` | number | `5432` | Database Port |
| `POSTGRES_HOST` | string | `postgres` | Database Host | | `POSTGRES_ENABLE_SSL` | boolean | `false` | Enable/Disable SSL for the database |
| `POSTGRES_USERNAME` | string | `automatisch_user` | Database User | | `POSTGRES_HOST` | string | `postgres` | Database Host |
| `POSTGRES_PASSWORD` | string | | Password of Database User | | `POSTGRES_USERNAME` | string | `automatisch_user` | Database User |
| `ENCRYPTION_KEY` | string | | Encryption Key to store credentials | | `POSTGRES_PASSWORD` | string | | Password of Database User |
| `WEBHOOK_SECRET_KEY` | string | | Webhook Secret Key to verify webhook requests | | `ENCRYPTION_KEY` | string | | Encryption Key to store credentials |
| `APP_SECRET_KEY` | string | | Secret Key to authenticate the user | | `WEBHOOK_SECRET_KEY` | string | | Webhook Secret Key to verify webhook requests |
| `REDIS_HOST` | string | `redis` | Redis Host | | `APP_SECRET_KEY` | string | | Secret Key to authenticate the user |
| `REDIS_PORT` | number | `6379` | Redis Port | | `REDIS_HOST` | string | `redis` | Redis Host |
| `REDIS_USERNAME` | string | | Redis Username | | `REDIS_PORT` | number | `6379` | Redis Port |
| `REDIS_PASSWORD` | string | | Redis Password | | `REDIS_USERNAME` | string | | Redis Username |
| `REDIS_TLS` | boolean | `false` | Redis TLS | | `REDIS_PASSWORD` | string | | Redis Password |
| `TELEMETRY_ENABLED` | boolean | `true` | Enable/Disable Telemetry | | `REDIS_TLS` | boolean | `false` | Redis TLS |
| `ENABLE_BULLMQ_DASHBOARD` | boolean | `false` | Enable BullMQ Dashboard | | `TELEMETRY_ENABLED` | boolean | `true` | Enable/Disable Telemetry |
| `BULLMQ_DASHBOARD_USERNAME` | string | | Username to login BullMQ Dashboard | | `ENABLE_BULLMQ_DASHBOARD` | boolean | `false` | Enable BullMQ Dashboard |
| `BULLMQ_DASHBOARD_PASSWORD` | string | | Password to login BullMQ Dashboard | | `BULLMQ_DASHBOARD_USERNAME` | string | | Username to login BullMQ Dashboard |
| `BULLMQ_DASHBOARD_PASSWORD` | string | | Password to login BullMQ Dashboard |