Remove from frontend the settings distribution role

This commit is contained in:
nemunaire 2022-06-08 02:51:17 +02:00
commit cfde1689cc
7 changed files with 28 additions and 37 deletions

View file

@ -1,10 +1,8 @@
package main
import (
"io/ioutil"
"log"
"os"
"path"
"time"
"srs.epita.fr/fic-server/settings"
@ -26,24 +24,6 @@ func touchStartedFile() {
}
func reloadSettings(config *settings.Settings) {
// Copy the new settings file for distribution
if data, err := ioutil.ReadFile(path.Join(settings.SettingsDir, settings.SettingsFile)); err != nil {
log.Println("Unable to read settings file:", err)
} else if err = ioutil.WriteFile(path.Join(SettingsDistDir, settings.SettingsFile+".tmp"), data, 0644); err != nil {
log.Println("Unable to write tmp settings file:", err)
} else if err := os.Rename(path.Join(SettingsDistDir, settings.SettingsFile+".tmp"), path.Join(SettingsDistDir, settings.SettingsFile)); err != nil {
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()