initial commit
This commit is contained in:
38
config/rabbit.go
Normal file
38
config/rabbit.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// RabbitMQConfig holds configuration for RabbitMQ
|
||||
type RabbitMQConfig struct {
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
VHost string
|
||||
MaxConnections int
|
||||
MaxChannels int
|
||||
ConnectionTimeout time.Duration
|
||||
HeartbeatInterval time.Duration
|
||||
ReconnectDelay time.Duration
|
||||
MaxReconnectDelay time.Duration
|
||||
ReconnectAttempts int
|
||||
EnableAutoReconnect bool
|
||||
LogLevel string
|
||||
MaxRetryAttempts int
|
||||
PrefetchCount int
|
||||
RetryTTL time.Duration
|
||||
}
|
||||
|
||||
// RabbitMQConnectionString returns the formatted RabbitMQ connection URI
|
||||
func (c *AppConfig) RabbitMQConnectionString() string {
|
||||
return fmt.Sprintf("amqp://%s:%s@%s:%d/%s",
|
||||
c.RabbitMQ.User,
|
||||
c.RabbitMQ.Password,
|
||||
c.RabbitMQ.Host,
|
||||
c.RabbitMQ.Port,
|
||||
c.RabbitMQ.VHost,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user