@spinajs/configuration
Advanced tools
Comparing version 2.0.255 to 2.0.256
@@ -15,2 +15,6 @@ import { ConfigurationSource, IConfigLike, Configuration, ConfigurationOptions, IConfigurationSchema } from '@spinajs/configuration-common'; | ||
/** | ||
* Env passed via CLI args ( in case if NODE_ENV var is not set ) | ||
*/ | ||
Env: string; | ||
/** | ||
* Current running app name | ||
@@ -17,0 +21,0 @@ */ |
@@ -59,2 +59,6 @@ "use strict"; | ||
/** | ||
* Env passed via CLI args ( in case if NODE_ENV var is not set ) | ||
*/ | ||
this.Env = "development"; | ||
/** | ||
* Current running app name | ||
@@ -70,2 +74,3 @@ */ | ||
this.AppBaseDir = options?.appBaseDir ?? (0, util_js_1.parseArgv)('--apppath') ?? (0, path_1.join)(process.cwd(), '../apps/'); | ||
this.Env = process.env.APP_ENV ?? (0, util_js_1.parseArgv)('--env'); | ||
} | ||
@@ -179,2 +184,3 @@ /** | ||
this.AppBaseDir, | ||
this.Env | ||
]); | ||
@@ -181,0 +187,0 @@ // sort asc sources |
@@ -6,2 +6,3 @@ import { Configuration, ConfigurationSource, IConfigLike } from '@spinajs/configuration-common'; | ||
protected appBaseDir?: string; | ||
protected Env?: string; | ||
/** | ||
@@ -14,3 +15,3 @@ * Configuration base dir, where to look for app config | ||
get Order(): number; | ||
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string); | ||
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string, Env?: string); | ||
protected load(extension: string, callback: (file: string) => Promise<unknown>): Promise<{}>; | ||
@@ -17,0 +18,0 @@ protected getEnvironment(config: Configuration): string; |
@@ -49,3 +49,3 @@ "use strict"; | ||
} | ||
constructor(RunApp, CustomConfigPaths, appBaseDir) { | ||
constructor(RunApp, CustomConfigPaths, appBaseDir, Env) { | ||
super(); | ||
@@ -55,2 +55,3 @@ this.RunApp = RunApp; | ||
this.appBaseDir = appBaseDir; | ||
this.Env = Env; | ||
/** | ||
@@ -116,3 +117,3 @@ * Configuration base dir, where to look for app config | ||
getEnvironment(config) { | ||
const env = config.get('process.env.APP_ENV', 'production'); | ||
let env = config.get('process.env.APP_ENV', undefined) ?? this.Env ?? 'production'; | ||
switch (env) { | ||
@@ -119,0 +120,0 @@ case 'dev': |
@@ -15,2 +15,6 @@ import { ConfigurationSource, IConfigLike, Configuration, ConfigurationOptions, IConfigurationSchema } from '@spinajs/configuration-common'; | ||
/** | ||
* Env passed via CLI args ( in case if NODE_ENV var is not set ) | ||
*/ | ||
Env: string; | ||
/** | ||
* Current running app name | ||
@@ -17,0 +21,0 @@ */ |
@@ -53,2 +53,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
/** | ||
* Env passed via CLI args ( in case if NODE_ENV var is not set ) | ||
*/ | ||
this.Env = "development"; | ||
/** | ||
* Current running app name | ||
@@ -64,2 +68,3 @@ */ | ||
this.AppBaseDir = options?.appBaseDir ?? parseArgv('--apppath') ?? join(process.cwd(), '../apps/'); | ||
this.Env = process.env.APP_ENV ?? parseArgv('--env'); | ||
} | ||
@@ -173,2 +178,3 @@ /** | ||
this.AppBaseDir, | ||
this.Env | ||
]); | ||
@@ -175,0 +181,0 @@ // sort asc sources |
@@ -6,2 +6,3 @@ import { Configuration, ConfigurationSource, IConfigLike } from '@spinajs/configuration-common'; | ||
protected appBaseDir?: string; | ||
protected Env?: string; | ||
/** | ||
@@ -14,3 +15,3 @@ * Configuration base dir, where to look for app config | ||
get Order(): number; | ||
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string); | ||
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string, Env?: string); | ||
protected load(extension: string, callback: (file: string) => Promise<unknown>): Promise<{}>; | ||
@@ -17,0 +18,0 @@ protected getEnvironment(config: Configuration): string; |
@@ -20,3 +20,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
} | ||
constructor(RunApp, CustomConfigPaths, appBaseDir) { | ||
constructor(RunApp, CustomConfigPaths, appBaseDir, Env) { | ||
super(); | ||
@@ -26,2 +26,3 @@ this.RunApp = RunApp; | ||
this.appBaseDir = appBaseDir; | ||
this.Env = Env; | ||
/** | ||
@@ -87,3 +88,3 @@ * Configuration base dir, where to look for app config | ||
getEnvironment(config) { | ||
const env = config.get('process.env.APP_ENV', 'production'); | ||
let env = config.get('process.env.APP_ENV', undefined) ?? this.Env ?? 'production'; | ||
switch (env) { | ||
@@ -90,0 +91,0 @@ case 'dev': |
{ | ||
"name": "@spinajs/configuration", | ||
"version": "2.0.255", | ||
"version": "2.0.256", | ||
"description": "framework configuration module", | ||
@@ -55,7 +55,7 @@ "main": "lib/cjs/index.js", | ||
"dependencies": { | ||
"@spinajs/configuration-common": "^2.0.255", | ||
"@spinajs/di": "^2.0.255", | ||
"@spinajs/exceptions": "^2.0.255", | ||
"@spinajs/internal-logger": "^2.0.255", | ||
"@spinajs/util": "2.0.255", | ||
"@spinajs/configuration-common": "^2.0.256", | ||
"@spinajs/di": "^2.0.256", | ||
"@spinajs/exceptions": "^2.0.256", | ||
"@spinajs/internal-logger": "^2.0.256", | ||
"@spinajs/util": "2.0.256", | ||
"ajv": "^8.12.0", | ||
@@ -62,0 +62,0 @@ "ajv-formats": "^2.1.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
258277
1678
10
+ Added@spinajs/util@2.0.256(transitive)
- Removed@spinajs/util@2.0.255(transitive)
Updated@spinajs/di@^2.0.256
Updated@spinajs/exceptions@^2.0.256
Updated@spinajs/util@2.0.256