Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(infra): read a null pool size as absent on config save
Yudhi Armyndharisd7a6364d29d4
diff --git a/src/modules/infra/config-sections.ts b/src/modules/infra/config-sections.tsindex 77b8435e3..f28e3327d 100644--- a/src/modules/infra/config-sections.ts+++ b/src/modules/infra/config-sections.ts@@ -89,7 +89,8 @@ export function applyDatabaseSection(updates.POSTGRES_SCHEMA = database.schema || 'public';}}- if (database.poolSize !== undefined) {+ // null is what JSON makes of an emptied number input, and reads as absent like the other fields.+ if (database.poolSize !== undefined && database.poolSize !== null) {if (!Number.isInteger(database.poolSize) || database.poolSize < 0) {throw new BadRequestException(`database.poolSize must be a non-negative integer (got ${JSON.stringify(database.poolSize)})`,diff --git a/src/modules/infra/infra-config.controller.spec.ts b/src/modules/infra/infra-config.controller.spec.tsindex 6c1b68eff..7c0030fb2 100644--- a/src/modules/infra/infra-config.controller.spec.ts+++ b/src/modules/infra/infra-config.controller.spec.ts@@ -792,6 +792,13 @@ describe('InfraConfigController.saveConfig per-key merge (partial payloads)', ()expect(env).toContain('DATABASE_PASSWORD=keepme');});+ it('a null pool size reads as absent and keeps the stored one', () => {+ const existing =+ 'DATABASE_TYPE=postgres\nPOSTGRES_BUILTIN=false\nDATABASE_HOST=old.example.com\nDATABASE_PASSWORD=keepme\nDATABASE_POOL_SIZE=25\n';+ const env = written({ database: { type: 'postgres', poolSize: null } }, existing);+ expect(env).toContain('DATABASE_POOL_SIZE=25');+ });+it('a partial storage save keeps the stored S3 region instead of resetting it to the default', () => {const existing ='STORAGE_TYPE=s3\nMINIO_BUILTIN=false\nS3_BUCKET=old-bucket\nS3_REGION=eu-west-1\nS3_ACCESS_KEY_ID=ak-strong\nS3_SECRET_ACCESS_KEY=sk-strong\n';