mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Handle missing server_url in setup (#1093)
Improve error handling to avoid a nil pointer panic in the setup endpoint.
This commit is contained in:
parent
2dbeea528e
commit
233cce6120
@ -11,7 +11,8 @@ import (
|
||||
func (mw validationMiddleware) NewAppConfig(ctx context.Context, payload fleet.AppConfigPayload) (*fleet.AppConfig, error) {
|
||||
invalid := &fleet.InvalidArgumentError{}
|
||||
var serverURLString string
|
||||
if payload.ServerSettings == nil {
|
||||
if payload.ServerSettings == nil || payload.ServerSettings.ServerURL == nil ||
|
||||
*payload.ServerSettings.ServerURL == "" {
|
||||
invalid.Append("server_url", "missing required argument")
|
||||
} else {
|
||||
serverURLString = cleanupURL(*payload.ServerSettings.ServerURL)
|
||||
|
Loading…
Reference in New Issue
Block a user