noauth 처리 추가

This commit is contained in:
2023-06-21 09:33:48 +09:00
parent b554a8783b
commit 2399f8cd27

View File

@ -458,7 +458,7 @@ func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMu
Priority: 0,
State: DivisionState_FullOpen,
},
Url: fmt.Sprintf("http://%s/warehouse", host),
Url: fmt.Sprintf("http://%s.actionsquare.corp/warehouse", host),
},
},
}
@ -576,6 +576,7 @@ func (mg *Maingate) query(w http.ResponseWriter, r *http.Request) {
return
}
if !*flag.Noauth {
apitoken := r.Header.Get("MG-X-API-TOKEN")
if len(apitoken) == 0 {
logger.Println("MG-X-API-TOKEN is missing")
@ -589,6 +590,7 @@ func (mg *Maingate) query(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusBadRequest)
return
}
}
bt, _ := json.Marshal(info)
w.Write(bt)