()
| 32 | } |
| 33 | |
| 34 | export async function readConfig(): Promise<SystemConfig> { |
| 35 | debug('Reading from %O', SYSCONFIG_PATH); |
| 36 | |
| 37 | try { |
| 38 | return await readJSON(SYSCONFIG_PATH); |
| 39 | } catch (e: any) { |
| 40 | if (e.code !== 'ENOENT') { |
| 41 | throw e; |
| 42 | } |
| 43 | |
| 44 | const sysconfig: SystemConfig = { |
| 45 | machine: uuidv4(), |
| 46 | }; |
| 47 | |
| 48 | await writeConfig(sysconfig); |
| 49 | |
| 50 | return sysconfig; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | export async function writeConfig(sysconfig: SystemConfig): Promise<void> { |
| 55 | debug('Writing to %O', SYSCONFIG_PATH); |
no test coverage detected