Only create config if it doesn't exist

This commit is contained in:
tsightler
2022-05-06 22:31:20 -04:00
parent 4612c19f5f
commit 8dda4d3dfd

View File

@@ -91,12 +91,14 @@ const main = async() => {
]
}
try {
await writeFileAtomic(configFile, JSON.stringify(configData, null, 4))
console.log('New config file written to '+configFile)
} catch (err) {
console.log('Failed to create new config file at '+stateFile)
conslog.log(err)
if (!fs.existsSync(configFile)) {
try {
await writeFileAtomic(configFile, JSON.stringify(configData, null, 4))
console.log('New config file written to '+configFile)
} catch (err) {
console.log('Failed to create new config file at '+stateFile)
conslog.log(err)
}
}
}