-
Notifications
You must be signed in to change notification settings - Fork 207
Add a handler to the WebRTC operator for context. #2431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now we are only querying the hostname. In the future |
||
| if err != nil { | ||
| http.Error(w, err.Error(), http.StatusInternalServerError) | ||
| return | ||
| } | ||
| ctx := make(map[string]interface{}) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use a defined |
||
| ctx["hostname"] = hostname | ||
| ReplyJSONOK(w, ctx) | ||
| } | ||
|
|
||
| // Control endpoint | ||
| func controlEndpoint(c *JSONUnix, pool *DevicePool) { | ||
| log.Println("Controller connected") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a endpoint /_debug/varz in HO and I think they aim to achieve the same, if so, let's use the same path for alignment.