diff --git a/frontend/src/liboperator/operator/operator.go b/frontend/src/liboperator/operator/operator.go index 6bd000bdb0a..3a9371f7c28 100644 --- a/frontend/src/liboperator/operator/operator.go +++ b/frontend/src/liboperator/operator/operator.go @@ -174,9 +174,23 @@ func CreateHttpHandlers( router.HandleFunc("/infra_config", func(w http.ResponseWriter, r *http.Request) { ReplyJSONOK(w, config) }).Methods("GET") + router.HandleFunc("/context", func(w http.ResponseWriter, r *http.Request) { + getContext(w, r) + }).Methods("GET") return router } +func getContext(w http.ResponseWriter, r *http.Request) { + hostname, err := os.Hostname() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + ctx := make(map[string]interface{}) + ctx["hostname"] = hostname + ReplyJSONOK(w, ctx) +} + // Control endpoint func controlEndpoint(c *JSONUnix, pool *DevicePool) { log.Println("Controller connected")