admin: Don't erase challenge.json if already exists
This commit is contained in:
parent
cfde1689cc
commit
159672ec47
@ -144,15 +144,17 @@ func main() {
|
|||||||
log.Println("Using", sync.GlobalImporter.Kind())
|
log.Println("Using", sync.GlobalImporter.Kind())
|
||||||
|
|
||||||
// Update distributed challenge.json
|
// Update distributed challenge.json
|
||||||
challengeinfo, err := sync.GetFileContent(sync.GlobalImporter, settings.ChallengeFile)
|
if _, err := os.Stat(path.Join(settings.SettingsDir, settings.ChallengeFile)); os.IsNotExist(err) {
|
||||||
if err == nil {
|
challengeinfo, err := sync.GetFileContent(sync.GlobalImporter, settings.ChallengeFile)
|
||||||
if fd, err := os.Create(path.Join(settings.SettingsDir, settings.ChallengeFile)); err != nil {
|
if err == nil {
|
||||||
log.Fatal("Unable to open SETTINGS/challenge.json:", err)
|
if fd, err := os.Create(path.Join(settings.SettingsDir, settings.ChallengeFile)); err != nil {
|
||||||
} else {
|
log.Fatal("Unable to open SETTINGS/challenge.json:", err)
|
||||||
fd.Write([]byte(challengeinfo))
|
} else {
|
||||||
err = fd.Close()
|
fd.Write([]byte(challengeinfo))
|
||||||
if err != nil {
|
err = fd.Close()
|
||||||
log.Fatal("Something went wrong during SETTINGS/challenge.json writing:", err)
|
if err != nil {
|
||||||
|
log.Fatal("Something went wrong during SETTINGS/challenge.json writing:", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user