settings: admin interface see default params
This commit is contained in:
parent
9d3afcba53
commit
10ce8ffa92
2 changed files with 12 additions and 1 deletions
|
@ -3,7 +3,9 @@ package api
|
|||
import (
|
||||
"encoding/json"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"srs.epita.fr/fic-server/libfic"
|
||||
"srs.epita.fr/fic-server/settings"
|
||||
|
||||
"github.com/julienschmidt/httprouter"
|
||||
|
@ -17,7 +19,11 @@ func init() {
|
|||
}
|
||||
|
||||
func getSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
return settings.ReadSettings(path.Join(TeamsDir, settings.SettingsFile))
|
||||
if settings.ExistsSettings(path.Join(TeamsDir, settings.SettingsFile)) {
|
||||
return settings.ReadSettings(path.Join(TeamsDir, settings.SettingsFile))
|
||||
} else {
|
||||
return settings.FICSettings{time.Unix(0,0), time.Unix(0,0), fic.FirstBlood, fic.SubmissionCostBase, false, false, false, true, true}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func saveSettings(_ httprouter.Params, body []byte) (interface{}, error) {
|
||||
|
|
Reference in a new issue