config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config provides configuration management for the PubSub standalone server. It loads settings from environment variables with sensible defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server   ServerConfig
	Database DatabaseConfig
	PubSub   PubSubConfig
}

Config holds all configuration for the PubSub server.

func Load

func Load() (*Config, error)

Load loads configuration from environment variables. Follows 12-factor app principles - configuration via environment.

type DatabaseConfig

type DatabaseConfig struct {
	Driver   string // mysql, postgres, sqlite3
	Host     string
	Port     int
	User     string
	Password string
	Database string
	Prefix   string // Table prefix (default: "pubsub_")
}

DatabaseConfig holds database connection configuration.

func (*DatabaseConfig) GetDSN

func (c *DatabaseConfig) GetDSN() string

GetDSN returns the database connection string based on driver.

type PubSubConfig

type PubSubConfig struct {
	BatchSize           int  // Worker batch size
	WorkerInterval      int  // Worker interval in seconds
	EnableNotifications bool // Enable notification service
}

PubSubConfig holds PubSub-specific configuration.

type ServerConfig

type ServerConfig struct {
	Host string
	Port int
}

ServerConfig holds HTTP server configuration.

Jump to

Keyboard shortcuts

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