@nestjs/config
Advanced tools
Comparing version 0.2.3 to 0.2.4
export declare const CONFIGURATION_SERVICE_TOKEN: unique symbol; | ||
export declare const CONFIGURATION_TOKEN = "CONFIGURATION_TOKEN"; | ||
export declare const CONFIGURATION_LOADER = "CONFIGURATION_LOADER"; | ||
export declare const VALIDATED_ENV_LOADER = "VALIDATED_ENV_LOADER"; | ||
export declare const PARTIAL_CONFIGURATION_KEY = "PARTIAL_CONFIGURATION_KEY"; | ||
export declare const PARTIAL_CONFIGURATION_PROPNAME = "KEY"; | ||
export declare const VALIDATED_ENV_PROPNAME = "_PROCESS_ENV_VALIDATED"; |
@@ -6,3 +6,5 @@ "use strict"; | ||
exports.CONFIGURATION_LOADER = 'CONFIGURATION_LOADER'; | ||
exports.VALIDATED_ENV_LOADER = 'VALIDATED_ENV_LOADER'; | ||
exports.PARTIAL_CONFIGURATION_KEY = 'PARTIAL_CONFIGURATION_KEY'; | ||
exports.PARTIAL_CONFIGURATION_PROPNAME = 'KEY'; | ||
exports.VALIDATED_ENV_PROPNAME = '_PROCESS_ENV_VALIDATED'; |
@@ -34,2 +34,3 @@ "use strict"; | ||
static forRoot(options = {}) { | ||
let validatedEnvConfig = undefined; | ||
if (!options.ignoreEnvFile) { | ||
@@ -46,2 +47,3 @@ if (options.validationSchema) { | ||
} | ||
validatedEnvConfig = validatedConfig; | ||
this.assignVariablesToProcess(validatedConfig); | ||
@@ -65,2 +67,12 @@ } | ||
providers.push(configServiceProvider); | ||
if (validatedEnvConfig) { | ||
const validatedEnvConfigLoader = { | ||
provide: config_constants_1.VALIDATED_ENV_LOADER, | ||
useFactory: (host) => { | ||
host[config_constants_1.VALIDATED_ENV_PROPNAME] = validatedEnvConfig; | ||
}, | ||
inject: [config_constants_1.CONFIGURATION_TOKEN], | ||
}; | ||
providers.push(validatedEnvConfigLoader); | ||
} | ||
return { | ||
@@ -67,0 +79,0 @@ module: ConfigModule_1, |
@@ -27,2 +27,6 @@ "use strict"; | ||
get(propertyPath, defaultValue) { | ||
const validatedEnvValue = lodash_get_1.default(this.internalConfig[config_constants_1.VALIDATED_ENV_PROPNAME], propertyPath); | ||
if (!util_1.isUndefined(validatedEnvValue)) { | ||
return validatedEnvValue; | ||
} | ||
const processValue = lodash_get_1.default(process.env, propertyPath); | ||
@@ -29,0 +33,0 @@ if (!util_1.isUndefined(processValue)) { |
{ | ||
"name": "@nestjs/config", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@config)", | ||
@@ -30,8 +30,8 @@ "author": "Kamil Mysliwiec", | ||
"@hapi/joi": "17.1.0", | ||
"@nestjs/common": "6.11.7", | ||
"@nestjs/core": "6.11.7", | ||
"@nestjs/platform-express": "6.11.7", | ||
"@nestjs/testing": "6.11.7", | ||
"@types/hapi__joi": "16.0.10", | ||
"@types/jest": "25.1.2", | ||
"@nestjs/common": "6.11.8", | ||
"@nestjs/core": "6.11.8", | ||
"@nestjs/platform-express": "6.11.8", | ||
"@nestjs/testing": "6.11.8", | ||
"@types/hapi__joi": "16.0.11", | ||
"@types/jest": "25.1.3", | ||
"@types/lodash.get": "4.4.6", | ||
@@ -45,3 +45,3 @@ "@types/lodash.set": "4.3.6", | ||
"eslint-plugin-import": "2.20.1", | ||
"release-it": "12.4.3", | ||
"release-it": "12.6.1", | ||
"@types/uuid": "3.4.7", | ||
@@ -55,4 +55,4 @@ "husky": "4.2.3", | ||
"rxjs": "6.5.4", | ||
"ts-jest": "25.2.0", | ||
"typescript": "3.7.5" | ||
"ts-jest": "25.2.1", | ||
"typescript": "3.8.2" | ||
}, | ||
@@ -59,0 +59,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25528
483