internal: better error message when outpost API controller couldn't fetch outposts
closes #4642 Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
9398fbcf9e
commit
5aa43eeb04
|
@ -55,7 +55,13 @@ func NewAPIController(akURL url.URL, token string) *APIController {
|
|||
config.Host = akURL.Host
|
||||
config.Scheme = akURL.Scheme
|
||||
config.HTTPClient = &http.Client{
|
||||
Transport: web.NewUserAgentTransport(constants.OutpostUserAgent(), web.NewTracingTransport(rsp.Context(), GetTLSTransport())),
|
||||
Transport: web.NewUserAgentTransport(
|
||||
constants.OutpostUserAgent(),
|
||||
web.NewTracingTransport(
|
||||
rsp.Context(),
|
||||
GetTLSTransport(),
|
||||
),
|
||||
),
|
||||
}
|
||||
config.AddDefaultHeader("Authorization", fmt.Sprintf("Bearer %s", token))
|
||||
|
||||
|
@ -73,6 +79,9 @@ func NewAPIController(akURL url.URL, token string) *APIController {
|
|||
time.Sleep(time.Second * 3)
|
||||
return NewAPIController(akURL, token)
|
||||
}
|
||||
if len(outposts.Results) < 1 {
|
||||
panic("No outposts found with given token, ensure the given token corresponds to an authenitk Outpost")
|
||||
}
|
||||
outpost := outposts.Results[0]
|
||||
|
||||
log.WithField("name", outpost.Name).Debug("Fetched outpost configuration")
|
||||
|
|
Reference in New Issue