@nestjs/config
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -35,21 +35,18 @@ "use strict"; | ||
let validatedEnvConfig = undefined; | ||
if (!options.ignoreEnvFile) { | ||
if (options.validationSchema) { | ||
let config = this.loadEnvFile(options); | ||
if (!options.ignoreEnvVars) { | ||
config = Object.assign(Object.assign({}, process.env), config); | ||
} | ||
const validationOptions = this.getSchemaValidationOptions(options); | ||
const { error, value: validatedConfig, } = options.validationSchema.validate(config, validationOptions); | ||
if (error) { | ||
throw new Error(`Config validation error: ${error.message}`); | ||
} | ||
validatedEnvConfig = validatedConfig; | ||
this.assignVariablesToProcess(validatedConfig); | ||
let config = options.ignoreEnvFile ? {} : this.loadEnvFile(options); | ||
if (!options.ignoreEnvVars) { | ||
config = Object.assign(Object.assign({}, process.env), config); | ||
} | ||
if (options.validationSchema) { | ||
const validationOptions = this.getSchemaValidationOptions(options); | ||
const { error, value: validatedConfig, } = options.validationSchema.validate(config, validationOptions); | ||
if (error) { | ||
throw new Error(`Config validation error: ${error.message}`); | ||
} | ||
else { | ||
const config = this.loadEnvFile(options); | ||
this.assignVariablesToProcess(config); | ||
} | ||
validatedEnvConfig = validatedConfig; | ||
this.assignVariablesToProcess(validatedConfig); | ||
} | ||
else { | ||
this.assignVariablesToProcess(config); | ||
} | ||
const isConfigToLoad = options.load && options.load.length; | ||
@@ -136,3 +133,4 @@ const providers = (options.load || []) | ||
} | ||
const keys = Object.keys(config).filter(key => !(key in process.env)); | ||
const keys = Object.keys(config).filter(key => !(key in process.env) || | ||
(key in process.env && process.env[key] !== config[key])); | ||
keys.forEach(key => (process.env[key] = config[key])); | ||
@@ -139,0 +137,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { NoInferType } from './types'; | ||
export declare class ConfigService { | ||
@@ -5,3 +6,3 @@ private readonly internalConfig; | ||
get<T = any>(propertyPath: string): T | undefined; | ||
get<T = any>(propertyPath: string, defaultValue: T): T; | ||
get<T = any>(propertyPath: string, defaultValue: NoInferType<T>): T; | ||
} |
export * from './config.type'; | ||
export * from './no-infer.type'; |
{ | ||
"name": "@nestjs/config", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@config)", | ||
@@ -24,3 +24,3 @@ "author": "Kamil Mysliwiec", | ||
"lodash.set": "4.3.2", | ||
"uuid": "7.0.2" | ||
"uuid": "8.0.0" | ||
}, | ||
@@ -31,26 +31,26 @@ "devDependencies": { | ||
"@hapi/joi": "17.1.1", | ||
"@nestjs/common": "7.0.1", | ||
"@nestjs/core": "7.0.1", | ||
"@nestjs/platform-express": "7.0.1", | ||
"@nestjs/testing": "7.0.1", | ||
"@types/hapi__joi": "16.0.12", | ||
"@types/jest": "25.1.4", | ||
"@nestjs/common": "7.0.9", | ||
"@nestjs/core": "7.0.9", | ||
"@nestjs/platform-express": "7.0.9", | ||
"@nestjs/testing": "7.0.9", | ||
"@types/hapi__joi": "17.1.0", | ||
"@types/jest": "25.2.1", | ||
"@types/lodash.get": "4.4.6", | ||
"@types/lodash.set": "4.3.6", | ||
"@types/node": "7.10.8", | ||
"@types/uuid": "7.0.0", | ||
"@typescript-eslint/eslint-plugin": "2.23.0", | ||
"@typescript-eslint/parser": "2.23.0", | ||
"@types/uuid": "7.0.3", | ||
"@typescript-eslint/eslint-plugin": "2.31.0", | ||
"@typescript-eslint/parser": "2.31.0", | ||
"eslint": "6.8.0", | ||
"eslint-config-prettier": "6.10.0", | ||
"eslint-plugin-import": "2.20.1", | ||
"husky": "4.2.3", | ||
"jest": "25.1.0", | ||
"lint-staged": "10.0.8", | ||
"prettier": "1.19.1", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-plugin-import": "2.20.2", | ||
"husky": "4.2.5", | ||
"jest": "26.0.1", | ||
"lint-staged": "10.2.2", | ||
"prettier": "2.0.5", | ||
"reflect-metadata": "0.1.13", | ||
"release-it": "13.1.1", | ||
"release-it": "13.5.8", | ||
"rimraf": "3.0.2", | ||
"rxjs": "6.5.4", | ||
"ts-jest": "25.2.1", | ||
"rxjs": "6.5.5", | ||
"ts-jest": "25.5.0", | ||
"typescript": "3.8.3" | ||
@@ -57,0 +57,0 @@ }, |
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
25498
42
479
7
+ Addeduuid@8.0.0(transitive)
- Removeduuid@7.0.2(transitive)
Updateduuid@8.0.0