mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge pull request #11409 from vector-im/travis/desktop-config
Let the user's homeserver config override the build config
This commit is contained in:
commit
efbb66ba4a
@ -77,6 +77,18 @@ try {
|
|||||||
try {
|
try {
|
||||||
// Load local config and use it to override values from the one baked with the build
|
// Load local config and use it to override values from the one baked with the build
|
||||||
const localConfig = require(path.join(app.getPath('userData'), 'config.json'));
|
const localConfig = require(path.join(app.getPath('userData'), 'config.json'));
|
||||||
|
|
||||||
|
// If the local config has a homeserver defined, don't use the homeserver from the build
|
||||||
|
// config. This is to avoid a problem where Riot thinks there are multiple homeservers
|
||||||
|
// defined, and panics as a result.
|
||||||
|
const homeserverProps = ['default_is_url', 'default_hs_url', 'default_server_name', 'default_server_config'];
|
||||||
|
if (Object.keys(localConfig).find(k => homeserverProps.includes(k))) {
|
||||||
|
// Rip out all the homeserver options from the vector config
|
||||||
|
vectorConfig = Object.keys(vectorConfig)
|
||||||
|
.filter(k => !homeserverProps.includes(k))
|
||||||
|
.reduce((obj, key) => {obj[key] = vectorConfig[key]; return obj;}, {});
|
||||||
|
}
|
||||||
|
|
||||||
vectorConfig = Object.assign(vectorConfig, localConfig);
|
vectorConfig = Object.assign(vectorConfig, localConfig);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Could not load local config, this is expected in most cases.
|
// Could not load local config, this is expected in most cases.
|
||||||
|
Loading…
Reference in New Issue
Block a user