feat(infra): lab5 add rabbitmq service and outbox config
This commit is contained in:
@@ -31,6 +31,9 @@ type Config struct {
|
||||
ReconcilerEnabled bool
|
||||
ReconcilerInterval time.Duration
|
||||
ReconcilerGracePeriod time.Duration
|
||||
|
||||
RabbitMQURL string
|
||||
OutboxInterval time.Duration
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -127,6 +130,16 @@ func Load() (*Config, error) {
|
||||
return nil, fmt.Errorf("RECONCILER_GRACE_SECONDS должен быть положительным")
|
||||
}
|
||||
|
||||
rabbitURL, err := readSecretOptional("RABBITMQ_URL_FILE", "RABBITMQ_URL")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("rabbitmq url: %w", err)
|
||||
}
|
||||
|
||||
outboxMs, err := readInt("OUTBOX_INTERVAL_MS", 1000)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("OUTBOX_INTERVAL_MS: %w", err)
|
||||
}
|
||||
|
||||
return &Config{
|
||||
Host: getenv("APP_HOST", "0.0.0.0"),
|
||||
Port: getenv("APP_PORT", "8080"),
|
||||
@@ -150,6 +163,9 @@ func Load() (*Config, error) {
|
||||
ReconcilerEnabled: reconcilerEnabled,
|
||||
ReconcilerInterval: time.Duration(reconcilerIntervalSec) * time.Second,
|
||||
ReconcilerGracePeriod: time.Duration(reconcilerGraceSec) * time.Second,
|
||||
|
||||
RabbitMQURL: rabbitURL,
|
||||
OutboxInterval: time.Duration(outboxMs) * time.Millisecond,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user