MCPcopy Create free account
hub / github.com/brimdata/super / Run

Method Run

cmd/super/db/auth/store.go:35–61  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

33}
34
35func (c *StoreCommand) Run(args []string) error {
36 _, cleanup, err := c.Init()
37 if err != nil {
38 return err
39 }
40 defer cleanup()
41 if len(args) > 0 {
42 return errors.New("store command takes no arguments")
43 }
44 if _, err := c.DBFlags.Connection(); err != nil {
45 // The Connection call here is to verify we're operating on a remote database.
46 return err
47 }
48 store := c.DBFlags.AuthStore()
49 tokens, err := store.Tokens(c.DBFlags.DB)
50 if err != nil {
51 return fmt.Errorf("failed to load authentication store: %w", err)
52 }
53 if tokens == nil {
54 tokens = &auth0.Tokens{}
55 }
56 tokens.Access = c.accessToken
57 if err := store.SetTokens(c.DBFlags.DB, *tokens); err != nil {
58 return fmt.Errorf("failed to update authentication: %w", err)
59 }
60 return nil
61}

Callers

nothing calls this directly

Calls 6

NewMethod · 0.80
ConnectionMethod · 0.80
AuthStoreMethod · 0.80
SetTokensMethod · 0.80
InitMethod · 0.65
TokensMethod · 0.45

Tested by

no test coverage detected