noauth 처리 추가
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user