diff --git a/cmd/server/app/history_purge.go b/cmd/server/app/history_purge.go index e17b0aaad4..ff177c76f0 100644 --- a/cmd/server/app/history_purge.go +++ b/cmd/server/app/history_purge.go @@ -28,14 +28,19 @@ var historyPurgeCmd = &cobra.Command{ } func historyPurgeCommand(cmd *cobra.Command, _ []string) error { - batchSize := viper.GetUint("batch-size") - dryRun := viper.GetBool("dry-run") - + // TODO: This statement and the following could be refactored + // in a function similar to `GRPCClientWrapRunE` + if err := viper.BindPFlags(cmd.Flags()); err != nil { + return fmt.Errorf("error binding flags: %s", err) + } cfg, err := config.ReadConfigFromViper[serverconfig.Config](viper.GetViper()) if err != nil { cliErrorf(cmd, "unable to read config: %s", err) } + batchSize := viper.GetUint("batch-size") + dryRun := viper.GetBool("dry-run") + ctx := serverconfig.LoggerFromConfigFlags(cfg.LoggingConfig).WithContext(context.Background()) // instantiate `db.Store` so we can run queries