mirror of
https://github.com/henrygd/beszel.git
synced 2026-08-17 12:46:22 +00:00
fix(agent): validate HUB_URL host to prevent misleading "lookup api" DNS error (#2011)
This commit is contained in:
+2
-2
@@ -53,8 +53,8 @@ func newWebSocketClient(agent *Agent) (client *WebSocketClient, err error) {
|
||||
client = &WebSocketClient{}
|
||||
|
||||
client.hubURL, err = url.Parse(hubURLStr)
|
||||
if err != nil {
|
||||
return nil, errors.New("invalid hub URL")
|
||||
if err != nil || client.hubURL.Host == "" {
|
||||
return nil, fmt.Errorf("invalid HUB_URL %q: must include scheme and host (e.g. http://hub.example.com:8090)", hubURLStr)
|
||||
}
|
||||
// get registration token
|
||||
client.token, err = getToken()
|
||||
|
||||
Reference in New Issue
Block a user