Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --schedule flag to usage run command #10678

Merged
merged 1 commit into from
Jun 16, 2022
Merged
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
4 changes: 3 additions & 1 deletion components/usage/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func run() *cobra.Command {
var (
verbose bool
apiKeyFile string
schedule time.Duration
)

cmd := &cobra.Command{
Expand All @@ -48,7 +49,7 @@ func run() *cobra.Command {
log.WithError(err).Fatal("Failed to initialize stripe client.")
}

ctrl, err := controller.New(1*time.Minute, controller.NewUsageReconciler(conn))
ctrl, err := controller.New(schedule, controller.NewUsageReconciler(conn))
if err != nil {
log.WithError(err).Fatal("Failed to initialize usage controller.")
}
Expand All @@ -72,6 +73,7 @@ func run() *cobra.Command {
}

cmd.Flags().BoolVar(&verbose, "verbose", false, "Toggle verbose logging (debug level)")
cmd.Flags().DurationVar(&schedule, "schedule", 1*time.Hour, "The schedule on which the reconciler should run")
cmd.Flags().StringVar(&apiKeyFile, "api-key-file", "/stripe-secret/apikeys", "Location of the stripe credentials file on disk")

return cmd
Expand Down