Skip to content

Commit

Permalink
Print warning when auth config lookup fails
Browse files Browse the repository at this point in the history
Don't exit the program when looking up the auth config fails but print a
warning instead.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
  • Loading branch information
welteki committed Jun 10, 2024
1 parent da19738 commit dfc983d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion commands/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func GetDefaultSDKClient() (*sdk.Client, error) {

authConfig, err := config.LookupAuthConfig(gatewayURL.String())
if err != nil {
return nil, fmt.Errorf("failed to lookup auth config: %w", err)
fmt.Printf("Failed to lookup auth config: %s\n", err)
}

var clientAuth sdk.ClientAuth
Expand Down
6 changes: 3 additions & 3 deletions commands/invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ func Test_invoke(t *testing.T) {
s := test.MockHttpServer(t, []test.Request{
{
Method: http.MethodPost,
Uri: "/function/" + funcName,
Uri: "/function/" + funcName + ".openfaas-fn",
ResponseStatusCode: http.StatusOK,
ResponseBody: expectedInvokeResponse,
},
})
defer s.Close()

os.Stdin, _ = ioutil.TempFile("", "stdin")
os.Stdin, _ = os.CreateTemp("", "stdin")
os.Stdin.WriteString("test-data")
os.Stdin.Seek(0, 0)
defer func() {
Expand Down Expand Up @@ -58,7 +58,7 @@ func Test_async_invoke(t *testing.T) {
s := test.MockHttpServer(t, []test.Request{
{
Method: http.MethodPost,
Uri: "/async-function/" + funcName,
Uri: "/async-function/" + funcName + ".openfaas-fn",
ResponseStatusCode: http.StatusAccepted,
},
})
Expand Down

0 comments on commit dfc983d

Please sign in to comment.