This commit is contained in:
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.warky.dev/wdevs/pgsql-broker/pkg/broker/adapter"
|
||||
@@ -47,7 +48,7 @@ type BrokerConfig struct {
|
||||
QueueTimerSec int `mapstructure:"queue_timer_sec"`
|
||||
QueueBufferSize int `mapstructure:"queue_buffer_size"`
|
||||
WorkerIdleTimeoutSec int `mapstructure:"worker_idle_timeout_sec"`
|
||||
NotifyRetrySeconds time.Duration `mapstructure:"notify_retry_seconds"`
|
||||
NotifyRetryInterval time.Duration `mapstructure:"notify_retry_seconds"`
|
||||
EnableDebug bool `mapstructure:"enable_debug"`
|
||||
// LeaseSeconds is how long a claimed job's lease is valid for before
|
||||
// broker_recover_stale_jobs considers it abandoned.
|
||||
@@ -132,7 +133,8 @@ func validateConfig(config *Config) error {
|
||||
}
|
||||
|
||||
// Validate each database configuration
|
||||
for i, db := range config.Databases {
|
||||
for i := range config.Databases {
|
||||
db := &config.Databases[i]
|
||||
if db.Name == "" {
|
||||
return fmt.Errorf("database[%d]: name is required", i)
|
||||
}
|
||||
@@ -195,5 +197,6 @@ func (d *DatabaseConfig) ToPostgresConfig() adapter.PostgresConfig {
|
||||
MaxIdleConns: d.MaxIdleConns,
|
||||
ConnMaxLifetime: d.ConnMaxLifetime,
|
||||
ConnMaxIdleTime: d.ConnMaxIdleTime,
|
||||
ApplicationName: fmt.Sprintf("PGSQL_BROKER_%s", strings.ToUpper(d.Name)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user