Files
2024-04-09 11:49:59 +00:00

37 lines
1.0 KiB
Go

package cmd
import (
"github.com/formancehq/ledger/internal/engine"
driver "github.com/formancehq/ledger/internal/storage/driver"
"github.com/formancehq/stack/libs/go-libs/auth"
"github.com/formancehq/stack/libs/go-libs/otlp/otlpmetrics"
"github.com/formancehq/stack/libs/go-libs/otlp/otlptraces"
"github.com/formancehq/stack/libs/go-libs/publish"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/fx"
)
const ServiceName = "ledger"
func resolveOptions(cmd *cobra.Command, userOptions ...fx.Option) []fx.Option {
options := make([]fx.Option, 0)
options = append(options, fx.NopLogger)
options = append(options,
publish.CLIPublisherModule(ServiceName),
otlptraces.CLITracesModule(),
otlpmetrics.CLIMetricsModule(),
auth.CLIAuthModule(),
driver.CLIModule(cmd),
engine.Module(engine.Configuration{
NumscriptCache: engine.NumscriptCacheConfiguration{
MaxCount: viper.GetInt(numscriptCacheMaxCountFlag),
},
LedgerBatchSize: viper.GetInt(ledgerBatchSizeFlag),
}),
)
return append(options, userOptions...)
}