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())
|
||||
|
||||
// Update distributed challenge.json
|
||||
challengeinfo, err := sync.GetFileContent(sync.GlobalImporter, settings.ChallengeFile)
|
||||
if err == nil {
|
||||
if fd, err := os.Create(path.Join(settings.SettingsDir, settings.ChallengeFile)); err != nil {
|
||||
log.Fatal("Unable to open SETTINGS/challenge.json:", err)
|
||||
} else {
|
||||
fd.Write([]byte(challengeinfo))
|
||||
err = fd.Close()
|
||||
if err != nil {
|
||||
log.Fatal("Something went wrong during SETTINGS/challenge.json writing:", err)
|
||||
if _, err := os.Stat(path.Join(settings.SettingsDir, settings.ChallengeFile)); os.IsNotExist(err) {
|
||||
challengeinfo, err := sync.GetFileContent(sync.GlobalImporter, settings.ChallengeFile)
|
||||
if err == nil {
|
||||
if fd, err := os.Create(path.Join(settings.SettingsDir, settings.ChallengeFile)); err != nil {
|
||||
log.Fatal("Unable to open SETTINGS/challenge.json:", err)
|
||||
} else {
|
||||
fd.Write([]byte(challengeinfo))
|
||||
err = fd.Close()
|
||||
if err != nil {
|
||||
log.Fatal("Something went wrong during SETTINGS/challenge.json writing:", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user