Settings are now given through TEAMS/settings.json instead of been given through command line arguments

This commit is contained in:
nemunaire 2016-12-30 12:45:14 +01:00 committed by Pierre-Olivier Mercier
parent 37310e41f5
commit 10fe40e4a8
9 changed files with 209 additions and 69 deletions

View file

@ -6,13 +6,21 @@ import (
"strings"
)
var denyNameChange bool = true
type ChNameHandler struct {}
func (n ChNameHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Printf("Handling %s name change request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
w.Header().Set("Content-Type", "application/json")
if denyNameChange {
log.Printf("UNHANDELED %s name change request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
http.Error(w, "{\"errmsg\":\"Le changement de nom est prohibé.\"}", http.StatusForbidden)
return
}
log.Printf("Handling %s name change request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
// Check request type and size
if r.Method != "POST" {
http.Error(w, "{\"errmsg\":\"Requête invalide.\"}", http.StatusBadRequest)