Skip to content

Commit b99625e

Browse files
committed
chore: update env config and examples
1 parent 3bff4e0 commit b99625e

File tree

5 files changed

+43
-251
lines changed

5 files changed

+43
-251
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ EVOAI_ENABLED=false
348348
# Redis Cache enabled
349349
CACHE_REDIS_ENABLED=true
350350
CACHE_REDIS_URI=redis://localhost:6379/6
351+
# Local machine Redis settings (used when NODE_ENV is not PROD)
352+
CACHE_REDIS_LOCAL_ENABLED=true
353+
CACHE_REDIS_LOCAL_URI=redis://localhost:6379/6
354+
# Production Redis settings (used when NODE_ENV=PROD)
355+
CACHE_REDIS_PRODUCTION_ENABLED=true
356+
CACHE_REDIS_PRODUCTION_URI=redis://your-production-redis:6379/6
351357
CACHE_REDIS_TTL=604800
352358
# Prefix serves to differentiate data from one installation to another that are using the same redis
353359
CACHE_REDIS_PREFIX_KEY=evolution

env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ DATABASE_DELETE_MESSAGE=false
4949
# ===========================================
5050
CACHE_REDIS_ENABLED=true
5151
CACHE_REDIS_URI=redis://localhost:6379
52+
CACHE_REDIS_LOCAL_ENABLED=true
53+
CACHE_REDIS_LOCAL_URI=redis://localhost:6379
54+
CACHE_REDIS_PRODUCTION_ENABLED=true
55+
CACHE_REDIS_PRODUCTION_URI=redis://your-production-redis:6379
5256
CACHE_REDIS_PREFIX_KEY=evolution-cache
5357
CACHE_REDIS_TTL=604800
5458
CACHE_REDIS_SAVE_INSTANCES=true

grafana-dashboard.json.example

Lines changed: 0 additions & 238 deletions
This file was deleted.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"test": "tsx watch ./test/all.test.ts",
1313
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --fix --ext .ts src",
1414
"lint:check": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .ts src",
15-
"commit": "cz",
1615
"commitlint": "commitlint --edit",
1716
"db:generate": "node runWithProvider.js \"npx prisma generate --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
1817
"db:deploy": "node runWithProvider.js \"rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate deploy --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
@@ -59,25 +58,28 @@
5958
"sh -c 'tsc --noEmit'"
6059
]
6160
},
62-
"config": {
63-
"commitizen": {
64-
"path": "cz-conventional-changelog"
65-
}
66-
},
6761
"dependencies": {
6862
"@adiwajshing/keyed-db": "^0.2.4",
6963
"@aws-sdk/client-sqs": "^3.891.0",
7064
"@ffmpeg-installer/ffmpeg": "^1.1.0",
71-
"@figuro/chatwoot-sdk": "^1.1.16",
65+
"@figuro/chatwoot-sdk": "^1.1.17",
7266
"@hapi/boom": "^10.0.1",
67+
"@nestjs/swagger": "^11.2.6",
68+
"@nx/eslint": "^22.6.3",
69+
"@nx/eslint-plugin": "^22.6.3",
70+
"@nx/jest": "^22.6.3",
71+
"@nx/playwright": "^22.6.3",
72+
"@nx/vite": "^22.6.3",
73+
"@nx/web": "^22.6.3",
74+
"@nx/webpack": "^22.6.3",
7375
"@paralleldrive/cuid2": "^2.2.2",
7476
"@prisma/client": "^6.16.2",
7577
"@sentry/node": "^10.12.0",
7678
"@types/uuid": "^10.0.0",
7779
"amqplib": "^0.10.5",
7880
"audio-decode": "^2.2.3",
7981
"axios": "^1.7.9",
80-
"baileys": "7.0.0-rc.9",
82+
"baileys": "^6.7.21",
8183
"class-validator": "^0.14.1",
8284
"compression": "^1.7.5",
8385
"cors": "^2.8.5",
@@ -87,10 +89,10 @@
8789
"eventemitter2": "^6.4.9",
8890
"express": "^4.21.2",
8991
"express-async-errors": "^3.1.1",
92+
"fetch-socks": "^1.3.2",
9093
"fluent-ffmpeg": "^2.1.3",
9194
"form-data": "^4.0.1",
9295
"https-proxy-agent": "^7.0.6",
93-
"fetch-socks": "^1.3.2",
9496
"i18next": "^23.7.19",
9597
"jimp": "^1.6.0",
9698
"json-schema": "^0.4.0",
@@ -141,8 +143,6 @@
141143
"@types/qrcode-terminal": "^0.12.2",
142144
"@typescript-eslint/eslint-plugin": "^8.44.0",
143145
"@typescript-eslint/parser": "^8.44.0",
144-
"commitizen": "^4.3.1",
145-
"cz-conventional-changelog": "^3.3.0",
146146
"eslint": "^8.45.0",
147147
"eslint-config-prettier": "^10.1.8",
148148
"eslint-plugin-import": "^2.31.0",

src/config/env.config.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,26 @@ export class ConfigService {
454454
}
455455

456456
private envProcess(): Env {
457+
const isProductionMode = process.env?.NODE_ENV === 'PROD';
458+
459+
const redisEnabledFallback = process.env?.CACHE_REDIS_ENABLED === 'true';
460+
const redisLocalEnabled = process.env?.CACHE_REDIS_LOCAL_ENABLED === 'true';
461+
const redisProductionEnabled = process.env?.CACHE_REDIS_PRODUCTION_ENABLED === 'true';
462+
463+
const redisUriFallback = process.env?.CACHE_REDIS_URI || '';
464+
const redisLocalUri = process.env?.CACHE_REDIS_LOCAL_URI || redisUriFallback;
465+
const redisProductionUri = process.env?.CACHE_REDIS_PRODUCTION_URI || redisUriFallback;
466+
467+
const selectedRedisEnabled = isProductionMode
468+
? process.env?.CACHE_REDIS_PRODUCTION_ENABLED
469+
? redisProductionEnabled
470+
: redisEnabledFallback
471+
: process.env?.CACHE_REDIS_LOCAL_ENABLED
472+
? redisLocalEnabled
473+
: redisEnabledFallback;
474+
475+
const selectedRedisUri = isProductionMode ? redisProductionUri : redisLocalUri;
476+
457477
return {
458478
SERVER: {
459479
NAME: process.env?.SERVER_NAME || 'evolution',
@@ -841,8 +861,8 @@ export class ConfigService {
841861
},
842862
CACHE: {
843863
REDIS: {
844-
ENABLED: process.env?.CACHE_REDIS_ENABLED === 'true',
845-
URI: process.env?.CACHE_REDIS_URI || '',
864+
ENABLED: selectedRedisEnabled,
865+
URI: selectedRedisUri,
846866
PREFIX_KEY: process.env?.CACHE_REDIS_PREFIX_KEY || 'evolution-cache',
847867
TTL: Number.parseInt(process.env?.CACHE_REDIS_TTL) || 604800,
848868
SAVE_INSTANCES: process.env?.CACHE_REDIS_SAVE_INSTANCES === 'true',

0 commit comments

Comments
 (0)