mirror of
https://github.com/netbirdio/dex.git
synced 2026-05-22 18:43:53 -07:00
Fix openshift context and add a comment
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
@@ -73,6 +73,8 @@ jobs:
|
||||
run: make deps
|
||||
|
||||
# Ensure that generated files were committed.
|
||||
# It can help us determine, that the code is in the intermediate state, which should not be tested.
|
||||
# Thus, heavy jobs like creating a kind cluster and testing / linting will be skipped.
|
||||
- name: Verify
|
||||
run: make verify
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ func (c *Config) OpenWithHTTPClient(id string, logger log.Logger,
|
||||
httpClient *http.Client,
|
||||
) (conn connector.Connector, err error) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
wellKnownURL := strings.TrimSuffix(c.Issuer, "/") + wellKnownURLPath
|
||||
req, err := http.NewRequest(http.MethodGet, wellKnownURL, nil)
|
||||
if err != nil {
|
||||
cancel()
|
||||
return nil, fmt.Errorf("failed to create a request to OpenShift endpoint %w", err)
|
||||
}
|
||||
|
||||
@@ -110,14 +110,12 @@ func (c *Config) OpenWithHTTPClient(id string, logger log.Logger,
|
||||
|
||||
resp, err := openshiftConnector.httpClient.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
cancel()
|
||||
return nil, fmt.Errorf("failed to query OpenShift endpoint %w", err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&metadata); err != nil {
|
||||
cancel()
|
||||
return nil, fmt.Errorf("discovery through endpoint %s failed to decode body: %w",
|
||||
wellKnownURL, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user