Settings are now given through TEAMS/settings.json instead of been given through command line arguments
This commit is contained in:
parent
b1541d9a45
commit
fae97e5411
9 changed files with 210 additions and 70 deletions
|
|
@ -8,10 +8,9 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
type TimeHandler struct {
|
||||
StartTime time.Time
|
||||
Duration time.Duration
|
||||
}
|
||||
var challengeStart time.Time
|
||||
|
||||
type TimeHandler struct {}
|
||||
|
||||
type timeObject struct {
|
||||
Started int64 `json:"st"`
|
||||
|
|
@ -24,7 +23,7 @@ func (t TimeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
if j, err := json.Marshal(timeObject{t.StartTime.Unix(), time.Now().Unix(), int(t.Duration.Seconds())}); err != nil {
|
||||
if j, err := json.Marshal(timeObject{challengeStart.Unix(), time.Now().Unix(), int(challengeEnd.Sub(challengeStart).Seconds())}); err != nil {
|
||||
http.Error(w, fmt.Sprintf("{\"errmsg\":\"%q\"}", err), http.StatusInternalServerError)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
|
|
|||
Reference in a new issue