Skip to content

Commit cbbea07

Browse files
committed
Update config
1 parent d3c7146 commit cbbea07

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

cmd/root.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func init() {
125125
rootCmd.PersistentFlags().Int("storage-staging-postgres-maxConnLifetime", 300, "PostgreSQL max connection lifetime in seconds for staging storage")
126126
rootCmd.PersistentFlags().Int("storage-staging-postgres-connectTimeout", 10, "PostgreSQL connection timeout in seconds for staging storage")
127127
// Kafka storage flags - only for main storage (where blockchain data is committed)
128-
rootCmd.PersistentFlags().Bool("storage-main-kafka-enabled", false, "Enable Kafka storage for main storage")
129128
rootCmd.PersistentFlags().String("storage-main-kafka-brokers", "", "Kafka brokers for main storage")
130129
rootCmd.PersistentFlags().String("storage-main-kafka-username", "", "Kafka username for main storage")
131130
rootCmd.PersistentFlags().String("storage-main-kafka-password", "", "Kafka password for main storage")
@@ -253,8 +252,6 @@ func init() {
253252
viper.BindPFlag("storage.staging.postgres.maxIdleConns", rootCmd.PersistentFlags().Lookup("storage-staging-postgres-maxIdleConns"))
254253
viper.BindPFlag("storage.staging.postgres.maxConnLifetime", rootCmd.PersistentFlags().Lookup("storage-staging-postgres-maxConnLifetime"))
255254
viper.BindPFlag("storage.staging.postgres.connectTimeout", rootCmd.PersistentFlags().Lookup("storage-staging-postgres-connectTimeout"))
256-
// Bind Kafka storage flags - only for main storage
257-
viper.BindPFlag("storage.main.kafka.enabled", rootCmd.PersistentFlags().Lookup("storage-main-kafka-enabled"))
258255
viper.BindPFlag("storage.main.kafka.brokers", rootCmd.PersistentFlags().Lookup("storage-main-kafka-brokers"))
259256
viper.BindPFlag("storage.main.kafka.username", rootCmd.PersistentFlags().Lookup("storage-main-kafka-username"))
260257
viper.BindPFlag("storage.main.kafka.password", rootCmd.PersistentFlags().Lookup("storage-main-kafka-password"))

configs/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ type PostgresConfig struct {
102102
}
103103

104104
type KafkaConfig struct {
105-
Enabled bool `mapstructure:"enabled"`
106105
Brokers string `mapstructure:"brokers"`
107106
Username string `mapstructure:"username"`
108107
Password string `mapstructure:"password"`

internal/storage/connector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ func NewStorageConnector(cfg *config.StorageConfig) (IStorage, error) {
148148
func NewConnector[T any](cfg *config.StorageConnectionConfig) (T, error) {
149149
var conn interface{}
150150
var err error
151-
if cfg.Postgres != nil {
151+
if cfg.Kafka != nil {
152+
conn, err = NewKafkaPostgresConnector(cfg.Kafka)
153+
} else if cfg.Postgres != nil {
152154
conn, err = NewPostgresConnector(cfg.Postgres)
153155
} else if cfg.Clickhouse != nil {
154156
conn, err = NewClickHouseConnector(cfg.Clickhouse)
155-
} else if cfg.Kafka != nil {
156-
conn, err = NewKafkaPostgresConnector(cfg.Kafka)
157157
} else {
158158
return *new(T), fmt.Errorf("no storage driver configured")
159159
}

internal/storage/kafka_postgres.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewKafkaPostgresConnector(cfg *config.KafkaConfig) (*KafkaPostgresConnector
5656

5757
// Initialize Kafka publisher if enabled
5858
var kafkaPublisher *KafkaPublisher
59-
if cfg.Enabled && cfg.Brokers != "" {
59+
if cfg.Brokers != "" {
6060
kafkaPublisher, err = NewKafkaPublisher(cfg)
6161
if err != nil {
6262
log.Warn().Err(err).Msg("Failed to initialize Kafka publisher, continuing without publishing")

0 commit comments

Comments
 (0)