From d2236e6b12ff77c77bdb1f9e732fea6821416aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Wed, 14 Jun 2023 14:05:17 +0200 Subject: [PATCH] fix: stringify primitives to avoid regressions --- lib/config.module.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/config.module.ts b/lib/config.module.ts index 45437970..84b60c52 100644 --- a/lib/config.module.ts +++ b/lib/config.module.ts @@ -184,8 +184,12 @@ export class ConfigModule { config, ); if (options.expandVariables) { - const expandOptions: DotenvExpandOptions = typeof options.expandVariables === 'object' ? options.expandVariables : {}; - config = expand({ ...expandOptions, parsed: config }).parsed || config; + const expandOptions: DotenvExpandOptions = + typeof options.expandVariables === 'object' + ? options.expandVariables + : {}; + config = + expand({ ...expandOptions, parsed: config }).parsed || config; } } } @@ -197,14 +201,14 @@ export class ConfigModule { return; } const keys = Object.keys(config).filter(key => !(key in process.env)); - keys.forEach( - key => { - const value = config[key]; - if (typeof value === 'string') { - process.env[key] = value; - } - }, - ); + keys.forEach(key => { + const value = config[key]; + if (typeof value === 'string') { + process.env[key] = value; + } else if (typeof value === 'boolean' || typeof value === 'number') { + process.env[key] = `${value}`; + } + }); } private static mergePartial(