Skip to content

Commit 4edda0d

Browse files
gianarbscotwells
andcommitted
fix: fix panic when token expires
We were getting a panic after a while after authentication. Running the command `auth login` refreshed the token and fixed the issue but this is the right long term fix. Co-Authored-By: Scot Schuchert-Wells <swells@datum.net>
1 parent e40fd5a commit 4edda0d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/cmd/root.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package cmd
22

33
import (
4+
"context"
5+
46
"github.com/spf13/cobra"
57
"go.datum.net/datumctl/internal/client"
68
"go.datum.net/datumctl/internal/cmd/auth"
@@ -30,13 +32,13 @@ func RootCmd() *cobra.Command {
3032
ErrOut: rootCmd.ErrOrStderr(),
3133
}
3234

33-
ctx := rootCmd.Context()
35+
ctx := context.Background()
3436
config, err := client.NewRestConfig(ctx)
3537
if err != nil {
3638
panic(err)
3739
}
3840

39-
factory, err := client.NewDatumFactory(rootCmd.Context(), config)
41+
factory, err := client.NewDatumFactory(ctx, config)
4042
if err != nil {
4143
panic(err)
4244
}

0 commit comments

Comments
 (0)