Skip to content
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

fix: fully prevent panic in remotecfg ui #2164

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions internal/web/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ func listComponentsHandlerRemoteCfg(host service.Host) http.HandlerFunc {
return
}

listComponentsHandlerInternal(svc.Data().(remotecfg.Data).Host, w, r)
data := svc.Data().(remotecfg.Data)
if data.Host == nil {
http.Error(w, "remote config service startup in progress", http.StatusInternalServerError)
return
}
listComponentsHandlerInternal(data.Host, w, r)
wildum marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -108,7 +113,13 @@ func getComponentHandlerRemoteCfg(host service.Host) http.HandlerFunc {
return
}

getComponentHandlerInternal(svc.Data().(remotecfg.Data).Host, w, r)
data := svc.Data().(remotecfg.Data)
if data.Host == nil {
http.Error(w, "remote config service startup in progress", http.StatusInternalServerError)
return
}

getComponentHandlerInternal(data.Host, w, r)
}
}

Expand Down