Skip to content

Commit

Permalink
fix: stringify primitives to avoid regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jun 14, 2023
1 parent 9f9b3fa commit d2236e6
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand All @@ -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(
Expand Down

0 comments on commit d2236e6

Please sign in to comment.