config

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Server configuration
	ListenAddr string

	// Database configuration
	DatabaseDSN string

	// Worker configuration
	WorkerInterval   time.Duration
	RetryMaxAttempts int
	RetryInterval    time.Duration

	// Shutdown configuration
	ShutdownDrainTimeout time.Duration

	// Auth configuration
	// JWTSecret is the HS256 secret used to validate tokens issued by the
	// deployer's backend. Set via JWT_SECRET environment variable.
	JWTSecret string

	// Webhook configuration (fired when a message arrives for an offline user)
	WebhookURL    string
	WebhookSecret string

	// WebSocket configuration
	// Comma-separated list of allowed origins. Use "*" to allow all (dev only).
	AllowedOrigins        []string
	MaxConnectionsPerUser int

	// Rate limiting (applied per user to message sends over REST and WebSocket)
	RateLimitMessages      float64 // sustained messages per second (0 = disabled)
	RateLimitMessagesBurst int     // burst allowance
}

Config holds all configuration for the ChatAPI service

func Load

func Load() (*Config, error)

Load loads configuration from environment variables with sensible defaults

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that required configuration values are set.

Jump to

Keyboard shortcuts

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