chore: Update config.js to read config file synchronously and merge configuration
This commit is contained in:
parent
b4cbfb4b46
commit
ad627e6596
1 changed files with 7 additions and 6 deletions
|
@ -271,13 +271,13 @@ function getConfigPath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the config file
|
* Reads the config file synchronously
|
||||||
* @param {string} configPath - The path to the config file
|
* @param {string} configPath - The path to the config file
|
||||||
* @returns {Config} The configuration object
|
* @returns {Object} The configuration object
|
||||||
*/
|
*/
|
||||||
function readConfigFile(configPath) {
|
function readConfigFile(configPath) {
|
||||||
console.log("WebSSH2 service reading config from: " + configPath)
|
console.log("WebSSH2 service reading config from: " + configPath)
|
||||||
return readConfig(configPath)
|
return readConfig.sync(configPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,8 +312,8 @@ function logError(message, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and merges the configuration
|
* Loads and merges the configuration synchronously
|
||||||
* @returns {Config} The merged configuration
|
* @returns {Object} The merged configuration
|
||||||
*/
|
*/
|
||||||
function loadConfig() {
|
function loadConfig() {
|
||||||
const configPath = getConfigPath()
|
const configPath = getConfigPath()
|
||||||
|
@ -376,9 +376,10 @@ function deepMerge(target, source) {
|
||||||
}
|
}
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The loaded configuration
|
* The loaded configuration
|
||||||
* @type {Config}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
const config = loadConfig()
|
const config = loadConfig()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue