@@ -22,11 +22,7 @@ import Debug from 'debug';
2222const log = Debug ( 'CID:ConfigStore' ) ;
2323
2424import { loadConfig , CONFIG_FILE_ENCODING } from './loadConfig.js' ;
25- import {
26- loadAppConfig ,
27- saveAppConfig ,
28- DEFAULT_APP_CONFIG ,
29- } from './appConfig.js' ;
25+ import { loadAppConfig , saveAppConfig , DEFAULT_APP_CONFIG } from './appConfig.js' ;
3026
3127import type { AppConfigData , Config } from './Config.js' ;
3228
@@ -109,10 +105,7 @@ export class ConfigStore {
109105 this . appConfig = loadAppConfig ( this . getAppConfigFilePath ( ) ) ;
110106
111107 // attempt to load the default app config
112- const userConfigLoad = loadConfig (
113- this . getConfigFilePath ( ) ,
114- this . getRegion ( ) ,
115- ) ;
108+ const userConfigLoad = loadConfig ( this . getConfigFilePath ( ) , this . getRegion ( ) ) ;
116109
117110 // if the load succesds we have a valid config -- use it as a
118111 // user-provided one
@@ -122,15 +115,10 @@ export class ConfigStore {
122115 return ;
123116 }
124117
125- console . log (
126- 'User config validation not successful - attempting to load backup config' ,
127- ) ;
118+ console . log ( 'User config validation not successful - attempting to load backup config' ) ;
128119 // if the default config load failed use the backup default
129120 // from the app distribution
130- const backupConfigLoad = loadConfig (
131- this . getBackupConfigFilePath ( ) ,
132- this . getRegion ( ) ,
133- ) ;
121+ const backupConfigLoad = loadConfig ( this . getBackupConfigFilePath ( ) , this . getRegion ( ) ) ;
134122
135123 // if the load succesds we have a valid config -- use it as
136124 // a config-from-backup
@@ -190,9 +178,7 @@ export class ConfigStore {
190178 // This method does not save the backup as the user config, only deletes the user config file
191179 removeUserConfig ( ) {
192180 // attempt to load the backup config
193- console . log (
194- '[removeUserConfig] Attempting to remove user configuration and replace with backup.' ,
195- ) ;
181+ console . log ( '[removeUserConfig] Attempting to remove user configuration and replace with backup.' ) ;
196182
197183 // if the current config is already a backup config don't do anything
198184 if ( this . isCurrentConfigBackup ( ) ) {
@@ -202,10 +188,7 @@ export class ConfigStore {
202188 }
203189
204190 console . log ( '[removeUserConfig] Trying to load backup config file' ) ;
205- const backupConfigLoad = loadConfig (
206- this . getBackupConfigFilePath ( ) ,
207- this . getRegion ( ) ,
208- ) ;
191+ const backupConfigLoad = loadConfig ( this . getBackupConfigFilePath ( ) , this . getRegion ( ) ) ;
209192
210193 // if failed return the error message (do not delete the user config yet)
211194 if ( ! backupConfigLoad . success ) {
@@ -220,9 +203,7 @@ export class ConfigStore {
220203 }
221204
222205 // if successful use the loaded backup configuration
223- console . log (
224- '[removeUserConfig] Backup config validation success - using it as config' ,
225- ) ;
206+ console . log ( '[removeUserConfig] Backup config validation success - using it as config' ) ;
226207 backupConfigLoad . config . isBackup = true ;
227208 this . useBackupConfig ( backupConfigLoad . config ) ;
228209
@@ -284,11 +265,7 @@ export class ConfigStore {
284265 }
285266
286267 _currentSignature ( ) {
287- if (
288- this . data &&
289- this . data . signature &&
290- this . data . signature . config_signature
291- ) {
268+ if ( this . data && this . data . signature && this . data . signature . config_signature ) {
292269 return this . data . signature . config_signature ;
293270 }
294271 return 'INVALID CONFIG, NO SIGNATURE' ;
@@ -310,6 +287,6 @@ export class ConfigStore {
310287}
311288
312289export function makeConfigStore ( storeConfig : ConfigStorePaths ) {
313- if ( ! storeConfig ) throw new Error ( `ConfigStore params MUST be provided.` )
290+ if ( ! storeConfig ) throw new Error ( `ConfigStore params MUST be provided.` ) ;
314291 return new ConfigStore ( storeConfig ) ;
315292}
0 commit comments