Distribute and handle challenge.json
This commit is contained in:
parent
e8f6a03cd9
commit
dff4f4eb63
20 changed files with 167 additions and 48 deletions
|
|
@ -37,6 +37,15 @@ func reloadSettings(config *settings.Settings) {
|
|||
log.Println("Unable to move new settings file:", err)
|
||||
}
|
||||
|
||||
// Copy the challenge info file for distribution
|
||||
if data, err := ioutil.ReadFile(path.Join(settings.SettingsDir, settings.ChallengeFile)); err != nil {
|
||||
log.Println("Unable to read challenge info file:", err)
|
||||
} else if err = ioutil.WriteFile(path.Join(SettingsDistDir, settings.ChallengeFile+".tmp"), data, 0644); err != nil {
|
||||
log.Println("Unable to write tmp challenge info file:", err)
|
||||
} else if err := os.Rename(path.Join(SettingsDistDir, settings.ChallengeFile+".tmp"), path.Join(SettingsDistDir, settings.ChallengeFile)); err != nil {
|
||||
log.Println("Unable to move new challenge info file:", err)
|
||||
}
|
||||
|
||||
if challengeStart != config.Start || challengeEnd != config.End {
|
||||
if touchTimer != nil {
|
||||
touchTimer.Stop()
|
||||
|
|
|
|||
Reference in a new issue