@incanta/config
Advanced tools
Comparing version 0.5.10 to 0.5.11
export interface IConfigOptions { | ||
configDir?: string; | ||
configEnv?: string; | ||
cwd?: string; | ||
} | ||
@@ -5,0 +6,0 @@ export interface IConfigSettings { |
@@ -34,4 +34,5 @@ "use strict"; | ||
let defaultConfigEnv = "default"; | ||
if (fs_1.default.existsSync(path_1.default.join(process.cwd(), "config-settings.json"))) { | ||
const configSettings = JSON.parse(fs_1.default.readFileSync(path_1.default.join(process.cwd(), "config-settings.json"), "utf-8")); | ||
const cwd = options?.cwd || process.cwd(); | ||
if (fs_1.default.existsSync(path_1.default.join(cwd, "config-settings.json"))) { | ||
const configSettings = JSON.parse(fs_1.default.readFileSync(path_1.default.join(cwd, "config-settings.json"), "utf-8")); | ||
if (configSettings.defaults) { | ||
@@ -52,4 +53,4 @@ if (configSettings.defaults.dir) { | ||
(process.env["NODE_CONFIG_DIR"] && | ||
path_1.default.relative(process.cwd(), process.env["NODE_CONFIG_DIR"])) || | ||
path_1.default.join(process.cwd(), defaultConfigDir); | ||
path_1.default.relative(cwd, process.env["NODE_CONFIG_DIR"])) || | ||
path_1.default.join(cwd, defaultConfigDir); | ||
const configEnv = options?.configEnv || process.env["NODE_CONFIG_ENV"] || defaultConfigEnv; | ||
@@ -56,0 +57,0 @@ const configEnvDir = this.configEnvDir(configEnv); |
{ | ||
"name": "@incanta/config", | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "exports": { |
@@ -11,2 +11,3 @@ import mergeWith from "lodash.mergewith"; | ||
configEnv?: string; | ||
cwd?: string; | ||
} | ||
@@ -53,8 +54,6 @@ | ||
let defaultConfigEnv = "default"; | ||
if (fs.existsSync(path.join(process.cwd(), "config-settings.json"))) { | ||
const cwd = options?.cwd || process.cwd(); | ||
if (fs.existsSync(path.join(cwd, "config-settings.json"))) { | ||
const configSettings: IConfigSettings = JSON.parse( | ||
fs.readFileSync( | ||
path.join(process.cwd(), "config-settings.json"), | ||
"utf-8" | ||
) | ||
fs.readFileSync(path.join(cwd, "config-settings.json"), "utf-8") | ||
); | ||
@@ -80,4 +79,4 @@ | ||
(process.env["NODE_CONFIG_DIR"] && | ||
path.relative(process.cwd(), process.env["NODE_CONFIG_DIR"])) || | ||
path.join(process.cwd(), defaultConfigDir); | ||
path.relative(cwd, process.env["NODE_CONFIG_DIR"])) || | ||
path.join(cwd, defaultConfigDir); | ||
@@ -84,0 +83,0 @@ const configEnv = |
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
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
81873
1476