config: copy missing from default (fix #971)
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/1010/head
parent
a8aa090be1
commit
a8a3efd21c
|
@ -23,8 +23,7 @@ class StaticConfig {
|
||||||
|
|
||||||
private async init() {
|
private async init() {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get<IConfig>(API.CONFIG_GET());
|
this.config = (await axios.get<IConfig>(API.CONFIG_GET())).data;
|
||||||
this.config = res.data as IConfig;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!utils.isNetworkError(e)) {
|
if (!utils.isNetworkError(e)) {
|
||||||
showError('Failed to load configuration');
|
showError('Failed to load configuration');
|
||||||
|
@ -57,6 +56,13 @@ class StaticConfig {
|
||||||
this.setLs(key, this.config[key]);
|
this.setLs(key, this.config[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy over all missing settings (e.g. local settings)
|
||||||
|
for (const key in old) {
|
||||||
|
if (!this.config.hasOwnProperty(key)) {
|
||||||
|
(this.config as any)[key] = (old as any)[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve all promises
|
// Resolve all promises
|
||||||
this.initPromises.forEach((resolve) => resolve());
|
this.initPromises.forEach((resolve) => resolve());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue