homegames-common 1.2.0 → 1.3.0
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/index.js +5 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -642,7 +642,7 @@ const getConfigValue = (key, _default = undefined) => {
|
|
|
642
642
|
throw new Error(`No value for ${key} found in config`);
|
|
643
643
|
} else if (config[key] === undefined && _default !== undefined) {
|
|
644
644
|
log.info(`Using default value (${_default}) for ${key}`);
|
|
645
|
-
return _default;
|
|
645
|
+
return DEFAULT_CONFIG[key] || _default;
|
|
646
646
|
}
|
|
647
647
|
log.info(`Found value ${config[key]} for ${key} in config`);
|
|
648
648
|
return config[key];
|
|
@@ -656,12 +656,14 @@ const getConfig = () => {
|
|
|
656
656
|
return cachedConfig;
|
|
657
657
|
}
|
|
658
658
|
|
|
659
|
-
const options = [process.cwd(), require.main.filename, process.mainModule.filename, __dirname]
|
|
659
|
+
const options = [getAppDataPath(), process.cwd(), require.main.filename, process.mainModule.filename, __dirname]
|
|
660
660
|
let _config = null;
|
|
661
|
+
let configPath = null;
|
|
661
662
|
|
|
662
663
|
for (let i = 0; i < options.length; i++) {
|
|
663
664
|
if (fs.existsSync(`${options[i]}/config.json`)) {
|
|
664
665
|
log.info(`Found config at ${options[i]}`);
|
|
666
|
+
configPath = options[i];
|
|
665
667
|
_config = JSON.parse(fs.readFileSync(`${options[i]}/config.json`));
|
|
666
668
|
break;
|
|
667
669
|
}
|
|
@@ -671,7 +673,7 @@ const getConfig = () => {
|
|
|
671
673
|
_config = DEFAULT_CONFIG;
|
|
672
674
|
}
|
|
673
675
|
|
|
674
|
-
log.info('Using config: ');
|
|
676
|
+
log.info('Using config: ' + configPath);
|
|
675
677
|
log.info(_config);
|
|
676
678
|
|
|
677
679
|
cachedConfig = _config;
|