binhend 2.3.10 → 2.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "2.3.10",
3
+ "version": "2.3.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Nguyen Duc Binh",
@@ -22,24 +22,25 @@ function env(options = Options()) {
22
22
  const envExtension = String(env, { default: undefined }) ? `.${env}` : '';
23
23
  const configModuleFileName = `./env${envExtension}.js`;
24
24
  const configModuleFilePath = path.resolve(options.path, configModuleFileName);
25
+ const localConfigs = {};
25
26
 
26
27
  try {
27
- const localConfigs = require(configModuleFilePath);
28
+ const fileConfigs = require(configModuleFilePath);
28
29
 
29
- for (var key in localConfigs) {
30
- const value = localConfigs[key];
30
+ for (var key in fileConfigs) {
31
+ const value = fileConfigs[key];
31
32
  localConfigs[key] = typeof value === 'string' ? value : JSON.stringify(value);
32
33
  }
33
-
34
- return {
35
- ...localConfigs,
36
- ...process.env,
37
- ...cli()
38
- };
39
34
  }
40
35
  catch (error) {
41
- throw new Error(`Failed loading config from: ${configModuleFilePath}`, { cause: error });
36
+ console.log(`[BINHEND][CONFIG] No config file: ${configModuleFilePath}`);
42
37
  }
38
+
39
+ return {
40
+ ...localConfigs,
41
+ ...process.env,
42
+ ...cli()
43
+ };
43
44
  };
44
45
 
45
46
  module.exports = { env };