Skip to content

Commit

Permalink
rework handling of store flag
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Sep 29, 2023
1 parent 6b41149 commit 1112b4f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmd/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const (
var (
requestURL string
authTokenFlag string
storePath string
)

func RPCFlags() *flag.FlagSet {
Expand All @@ -44,13 +43,7 @@ func RPCFlags() *flag.FlagSet {
)

storeFlag := NodeFlags().Lookup(nodeStoreFlag)

fset.StringVar(
&storePath,
nodeStoreFlag,
"",
storeFlag.Usage,
)
fset.AddFlag(storeFlag)
return fset
}

Expand All @@ -60,6 +53,10 @@ func InitClient(cmd *cobra.Command, _ []string) error {
}

if authTokenFlag == "" {
storePath := ""
if cmd.Flag(nodeStoreFlag).Changed {
storePath = cmd.Flag(nodeStoreFlag).Value.String()
}
token, err := getToken(storePath)
if err != nil {
return fmt.Errorf("cant get the access to the auth token: %v", err)
Expand Down

0 comments on commit 1112b4f

Please sign in to comment.