config

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig added in v0.4.1

func ValidateConfig(c *Config) error

ValidateConfig is a convenience function to validate a config pointer. Returns nil if the config is valid.

Types

type Config

type Config struct {
	// PubSubSystem selects the backing message infrastructure. Supported values:
	// "kafka", "rabbitmq", or "aws" (SNS/SQS).
	PubSubSystem string

	// Kafka configuration.
	KafkaBrokers       []string
	KafkaClientID      string
	KafkaConsumerGroup string

	// RabbitMQ configuration.
	RabbitMQURL string

	// NATS configuration.
	NATSURL string

	// HTTP configuration.
	HTTPServerAddress string
	// HTTPPublisherURL is the base URL where messages will be sent.
	HTTPPublisherURL string

	// I/O configuration.
	// IOFile is the path to the file used for persistence.
	IOFile string

	// SQLite configuration.
	// SQLiteFile is the path to the SQLite database file.
	// Use ":memory:" for an in-memory database (useful for testing).
	SQLiteFile string

	// PostgreSQL configuration.
	// PostgresURL is the PostgreSQL connection string.
	// Example: "postgres://user:password@localhost:5432/dbname?sslmode=disable"
	PostgresURL string

	// PoisonQueue receives messages that cannot be processed even after retries.
	PoisonQueue string

	// AWS (SNS/SQS) configuration.
	AWSRegion          string
	AWSAccountID       string
	AWSAccessKeyID     string
	AWSSecretAccessKey string
	// AWSEndpoint optionally points to a custom endpoint (for example, LocalStack
	// in local development).
	AWSEndpoint string

	// RetryMiddleware tuning. Zero values fall back to library defaults.
	RetryMaxRetries      int
	RetryInitialInterval time.Duration
	RetryMaxInterval     time.Duration

	// Metrics configuration.
	MetricsEnabled bool
	// MetricsPort is the port where Prometheus metrics will be exposed.
	MetricsPort int

	// WebUI configuration.
	WebUIEnabled bool
	// WebUIPort is the port where the WebUI API will be exposed. Defaults to 8081.
	WebUIPort int
	// WebUICORSAllowedOrigins specifies allowed origins for CORS. Use "*" for development
	// or specific origins like "https://example.com" for production. Empty disables CORS headers.
	WebUICORSAllowedOrigins []string
}

Config groups the Pub/Sub settings required to initialise the Service. Each transport only uses the keys that are relevant to it.

func (*Config) GetAWSAccessKeyID added in v0.4.1

func (c *Config) GetAWSAccessKeyID() string

func (*Config) GetAWSAccountID added in v0.4.1

func (c *Config) GetAWSAccountID() string

func (*Config) GetAWSEndpoint added in v0.4.1

func (c *Config) GetAWSEndpoint() string

func (*Config) GetAWSRegion added in v0.4.1

func (c *Config) GetAWSRegion() string

func (*Config) GetAWSSecretAccessKey added in v0.4.1

func (c *Config) GetAWSSecretAccessKey() string

func (*Config) GetHTTPPublisherURL added in v0.4.1

func (c *Config) GetHTTPPublisherURL() string

func (*Config) GetHTTPServerAddress added in v0.4.1

func (c *Config) GetHTTPServerAddress() string

func (*Config) GetIOFile added in v0.4.1

func (c *Config) GetIOFile() string

func (*Config) GetKafkaBrokers added in v0.4.1

func (c *Config) GetKafkaBrokers() []string

func (*Config) GetKafkaConsumerGroup added in v0.4.1

func (c *Config) GetKafkaConsumerGroup() string

func (*Config) GetNATSURL added in v0.4.1

func (c *Config) GetNATSURL() string

func (*Config) GetPostgresURL added in v0.4.1

func (c *Config) GetPostgresURL() string

func (*Config) GetPubSubSystem added in v0.4.1

func (c *Config) GetPubSubSystem() string

Getter methods to implement transport.Config interface.

func (*Config) GetRabbitMQURL added in v0.4.1

func (c *Config) GetRabbitMQURL() string

func (*Config) GetSQLiteFile added in v0.4.1

func (c *Config) GetSQLiteFile() string

func (Config) String added in v0.3.2

func (c Config) String() string

func (*Config) Validate added in v0.4.1

func (c *Config) Validate() error

Validate checks that the configuration has all required fields for the selected transport. Returns an error describing any missing or invalid configuration. Note: validation of pubsub system values is lenient to allow custom transport factories.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL