admin: initialize directory structure and required files at launch
This commit is contained in:
parent
7da6f5cd0c
commit
af2fe21d73
2 changed files with 25 additions and 22 deletions
|
|
@ -4,7 +4,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"srs.epita.fr/fic-server/admin/sync"
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
|
|
@ -33,24 +32,7 @@ func getROSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
|||
}
|
||||
|
||||
func getSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
if settings.ExistsSettings(path.Join(settings.SettingsDir, settings.SettingsFile)) {
|
||||
return settings.ReadSettings(path.Join(settings.SettingsDir, settings.SettingsFile))
|
||||
} else {
|
||||
return settings.FICSettings{
|
||||
Title: "Challenge FIC",
|
||||
Authors: "Laboratoire SRS, ÉPITA",
|
||||
Start: time.Unix(0, 0),
|
||||
End: time.Unix(0, 0),
|
||||
Generation: time.Unix(0, 0),
|
||||
FirstBlood: fic.FirstBlood,
|
||||
SubmissionCostBase: fic.SubmissionCostBase,
|
||||
AllowRegistration: false,
|
||||
DenyNameChange: false,
|
||||
EnableResolutionRoute: false,
|
||||
PartialValidation: true,
|
||||
EnableExerciceDepend: true,
|
||||
}, nil
|
||||
}
|
||||
return settings.ReadSettings(path.Join(settings.SettingsDir, settings.SettingsFile))
|
||||
}
|
||||
|
||||
func saveSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
|
|
|
|||
Reference in a new issue