mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* feat: Create EE architecture * feat: Move Fireblocks to EE * feat: Add dual CE/EE licensing model Update root LICENSE to dual-license format distinguishing Community Edition (MIT) from Enterprise Edition (ee/LICENSE), aligned with the formancehq/stack licensing model. * refactor: Rename main_ee.go to ee.go for cleaner build tag convention * feat: Move Coinbase Prime to EE * feat: just * fix: tidy & package name
82 lines
2.4 KiB
Go
82 lines
2.4 KiB
Go
package cmd
|
|
|
|
import (
|
|
_ "github.com/bombsimon/logrusr/v3"
|
|
"github.com/formancehq/go-libs/v3/bun/bunmigrate"
|
|
"github.com/formancehq/go-libs/v3/service"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
ServiceName = "payments"
|
|
Version = "develop"
|
|
BuildDate = "-"
|
|
Commit = "-"
|
|
Edition = "community"
|
|
)
|
|
|
|
const (
|
|
ConfigEncryptionKeyFlag = "config-encryption-key"
|
|
ListenFlag = "listen"
|
|
StackFlag = "stack"
|
|
ConnectorPollingPeriodDefault = "connector-polling-period-default"
|
|
ConnectorPollingPeriodMinimum = "connector-polling-period-minimum"
|
|
stackPublicURLFlag = "stack-public-url"
|
|
temporalMaxConcurrentWorkflowTaskPollersFlag = "temporal-max-concurrent-workflow-task-pollers"
|
|
temporalMaxConcurrentActivityTaskPollersFlag = "temporal-max-concurrent-activity-task-pollers"
|
|
temporalMaxSlotsPerPollerFlag = "temporal-max-slots-per-poller"
|
|
temporalMaxLocalActivitySlotsFlag = "temporal-max-local-activity-slots"
|
|
temporalRateLimitingRetryDelay = "temporal-rate-limiting-retry-delay"
|
|
OutboxPollingIntervalFlag = "outbox-schedule-polling-interval"
|
|
OutboxCleanupIntervalFlag = "outbox-schedule-cleanup-interval"
|
|
SkipOutboxScheduleCreationFlag = "skip-outbox-schedule-creation"
|
|
)
|
|
|
|
func NewRootCommand() *cobra.Command {
|
|
root := &cobra.Command{
|
|
Use: "payments",
|
|
Short: "payments",
|
|
DisableAutoGenTag: true,
|
|
Version: Version,
|
|
}
|
|
|
|
root.PersistentFlags().String(ConfigEncryptionKeyFlag, "", "Config encryption key")
|
|
|
|
version := newVersion()
|
|
root.AddCommand(version)
|
|
|
|
migrate := newMigrate()
|
|
root.AddCommand(migrate)
|
|
|
|
server := newServer()
|
|
addAutoMigrateCommand(server)
|
|
root.AddCommand(server)
|
|
|
|
worker := newWorker()
|
|
root.AddCommand(worker)
|
|
|
|
purge := newPurge()
|
|
purge.Flags().String(StackFlag, "", "Stack name")
|
|
root.AddCommand(purge)
|
|
|
|
workbench := newWorkbench()
|
|
root.AddCommand(workbench)
|
|
|
|
return root
|
|
}
|
|
|
|
func Execute() {
|
|
service.Execute(NewRootCommand())
|
|
}
|
|
|
|
func addAutoMigrateCommand(cmd *cobra.Command) {
|
|
cmd.Flags().Bool(autoMigrateFlag, false, "Auto migrate database")
|
|
cmd.PreRunE = func(cmd *cobra.Command, args []string) error {
|
|
autoMigrate, _ := cmd.Flags().GetBool(autoMigrateFlag)
|
|
if autoMigrate {
|
|
return bunmigrate.Run(cmd, args, Migrate)
|
|
}
|
|
return nil
|
|
}
|
|
}
|