Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/invoke/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ func NewCmd() *cobra.Command {
server string
username string
password string
token string
)

cmd := &cobra.Command{
Use: "invoke <promise-id> --func <function-name> [flags]",
Short: "Invoke a function",
Example: invokeExample,
PreRunE: func(cmd *cobra.Command, cmdArgs []string) error {
if username != "" || password != "" {
if token != "" {
c.SetBearerToken(token)
} else if username != "" || password != "" {
c.SetBasicAuth(username, password)
}

Expand Down Expand Up @@ -142,6 +145,7 @@ func NewCmd() *cobra.Command {
cmd.Flags().StringVar(&server, "server", "http://localhost:8001", "resonate server url")
cmd.Flags().StringVarP(&username, "username", "U", "", "basic auth username")
cmd.Flags().StringVarP(&password, "password", "P", "", "basic auth password")
cmd.Flags().StringVar(&token, "token", "", "bearer token for authentication")

cmd.Flags().SortFlags = false
_ = cmd.MarkFlagRequired("func")
Expand Down
6 changes: 5 additions & 1 deletion cmd/promises/promises.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func NewCmd() *cobra.Command {
server string
username string
password string
token string
)

cmd := &cobra.Command{
Expand All @@ -27,7 +28,9 @@ func NewCmd() *cobra.Command {
_ = cmd.Help()
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if username != "" || password != "" {
if token != "" {
c.SetBearerToken(token)
} else if username != "" || password != "" {
c.SetBasicAuth(username, password)
}

Expand All @@ -47,6 +50,7 @@ func NewCmd() *cobra.Command {
cmd.PersistentFlags().StringVarP(&server, "server", "", "http://localhost:8001", "resonate url")
cmd.PersistentFlags().StringVarP(&username, "username", "U", "", "basic auth username")
cmd.PersistentFlags().StringVarP(&password, "password", "P", "", "basic auth password")
cmd.PersistentFlags().StringVar(&token, "token", "", "bearer token for authentication")

return cmd
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/schedules/schedules.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func NewCmd() *cobra.Command {
server string
username string
password string
token string
)

cmd := &cobra.Command{
Expand All @@ -27,7 +28,9 @@ func NewCmd() *cobra.Command {
_ = cmd.Help()
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if username != "" || password != "" {
if token != "" {
c.SetBearerToken(token)
} else if username != "" || password != "" {
c.SetBasicAuth(username, password)
}

Expand All @@ -45,6 +48,7 @@ func NewCmd() *cobra.Command {
cmd.PersistentFlags().StringVarP(&server, "server", "", "http://localhost:8001", "resonate url")
cmd.PersistentFlags().StringVarP(&username, "username", "U", "", "basic auth username")
cmd.PersistentFlags().StringVarP(&password, "password", "P", "", "basic auth password")
cmd.PersistentFlags().StringVar(&token, "token", "", "bearer token for authentication")

return cmd
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/tasks/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func NewCmd() *cobra.Command {
server string
username string
password string
token string
)

cmd := &cobra.Command{
Expand All @@ -22,7 +23,9 @@ func NewCmd() *cobra.Command {
_ = cmd.Help()
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if username != "" || password != "" {
if token != "" {
c.SetBearerToken(token)
} else if username != "" || password != "" {
c.SetBasicAuth(username, password)
}
return c.Setup(server)
Expand All @@ -38,6 +41,7 @@ func NewCmd() *cobra.Command {
cmd.PersistentFlags().StringVarP(&server, "server", "", "http://localhost:8001", "Resonate server URL")
cmd.PersistentFlags().StringVarP(&username, "username", "U", "", "Basic auth username")
cmd.PersistentFlags().StringVarP(&password, "password", "P", "", "Basic auth password")
cmd.PersistentFlags().StringVar(&token, "token", "", "bearer token for authentication")

return cmd
}
Loading
Loading