Skip to content

Commit

Permalink
feat(egress): persistent flag
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdeenen committed Jul 9, 2021
1 parent 243af63 commit c7dad70
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cmd/egress.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import (
var EgressCmd = &cobra.Command{
Use: "egress",
Short: "Read from egress",
Run: func(cmd *cobra.Command, args []string) { egress.Run(cmd, &args[0]) },
Run: func(cmd *cobra.Command, args []string) {
egress.Run(cmd, &args[0])
},
Args: cobra.ExactArgs(1), // the stream name
ValidArgsFunction: stream.ExistingNamesCompletion,
}

func init() {
flags := EgressCmd.Flags()
flags.String(egress.UrlFlag, "wss://out.strm.services/ws",
"where to retrieve the events")
flags.String(sims.ClientIdFlag, "", "client id to be used for sending data")
flags.String(sims.ClientSecretFlag, "", "client secret to be used for sending data")

}
}
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func init() {
RootCmd.PersistentFlags().String(auth.ApiAuthUrlFlag, "https://api.streammachine.io/v1", "Auth URL for user logins")
RootCmd.PersistentFlags().StringVar(&auth.TokenFile, "token-file", "",
"config file (default is $HOME/.config/stream-machine/strm-creds-<api-auth-host>.json)")
RootCmd.PersistentFlags().String(egress.UrlFlag, "wss://out.strm.services/ws", "where to retrieve the events")
setupVerbs()
}

Expand Down Expand Up @@ -206,4 +207,4 @@ func bindFlags(cmd *cobra.Command, v *viper.Viper) {
cobra.CheckErr(err)
}
})
}
}
6 changes: 4 additions & 2 deletions egress/egress.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import (
"streammachine.io/strm/utils"
)

const UrlFlag = "egress"
const (
UrlFlag = "egress"
)

var BillingId string

Expand Down Expand Up @@ -47,4 +49,4 @@ func Run(cmd *cobra.Command, streamName *string) {
cobra.CheckErr(err)
fmt.Println(string(message))
}
}
}

0 comments on commit c7dad70

Please sign in to comment.