admin: Copy challenge.json from sync to distsettings

This commit is contained in:
nemunaire 2022-05-26 12:26:53 +02:00
parent 4b2625c47d
commit eb07eadae0
2 changed files with 37 additions and 1 deletions

View file

@ -142,6 +142,20 @@ func main() {
log.Fatal("Unable to initialize the importer:", err)
}
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)
}
}
}
}
// Sanitize options