fix(api): correctly generate clientId on first startup

pull/238/head
sct 4 years ago
parent 27349ec953
commit 5f09e83ed8

@ -100,7 +100,7 @@ class Settings {
constructor(initialSettings?: AllSettings) { constructor(initialSettings?: AllSettings) {
this.data = { this.data = {
clientId: '', clientId: uuidv4(),
main: { main: {
apiKey: '', apiKey: '',
applicationUrl: '', applicationUrl: '',
@ -222,10 +222,10 @@ class Settings {
* @param overrideSettings If passed in, will override all existing settings with these * @param overrideSettings If passed in, will override all existing settings with these
* values * values
*/ */
public load(overrideSettings?: AllSettings): AllSettings { public load(overrideSettings?: AllSettings): Settings {
if (overrideSettings) { if (overrideSettings) {
this.data = overrideSettings; this.data = overrideSettings;
return this.data; return this;
} }
if (!fs.existsSync(SETTINGS_PATH)) { if (!fs.existsSync(SETTINGS_PATH)) {
@ -237,7 +237,7 @@ class Settings {
this.data = merge(this.data, JSON.parse(data)); this.data = merge(this.data, JSON.parse(data));
this.save(); this.save();
} }
return this.data; return this;
} }
public save(): void { public save(): void {

Loading…
Cancel
Save