mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-09-26 21:01:12 +08:00
Only create config if it doesn't exist
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user