config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads and validates the application configuration from the environment (12-factor). In development a .env file in the working directory is loaded automatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Telegram
	BotToken   string
	OwnerTGIDs []int64

	// Storage
	DBPath string

	// Observed sources
	BoostyGroupID    int64
	TributeChannelID int64

	// Managed club resources
	ClubChatID     int64
	ClubChannelID  int64
	AdminLogChatID *int64 // nil when unset

	// Operator event feed. A dedicated group where the bot and owner are
	// members; carries the human-readable access/membership event log,
	// separate from ADMIN_LOG_CHAT_ID ops alerts.
	EventLogChatID int64

	// Subscribe links
	BoostySubscribeURL     string
	TributeSubscribeURLRub string
	TributeSubscribeURLEur string

	// Access granting
	InviteMode                  string
	InviteTTL                   time.Duration
	AllowDirectInvites          bool
	AdmissionFallbackMaxAge     time.Duration
	AdmissionJoinRequestRetries int

	// Tribute
	TributeMode              string
	TributeAPIKey            string
	TributeCancelIsImmediate bool
	WebhookListenAddr        string
	TributeWebhookPath       string

	// Telegram transport
	TelegramMode             string
	TelegramWebhookPublicURL string
	TelegramWebhookPath      string
	TelegramWebhookSecret    string

	// Expiry policy
	ExpiryMode        string
	GracePeriod       time.Duration
	ReconcileInterval time.Duration
	CleanupInterval   time.Duration
	RawRetention      time.Duration
	AuditRetention    time.Duration
	EnforcerWorkers   int

	// Misc
	Timezone       string
	Location       *time.Location
	LogLevel       string
	LogFormat      string
	MetricsEnabled bool
}

Config is the fully parsed and validated application configuration.

func Load

func Load() (Config, error)

Load reads the configuration from the process environment, applying defaults and validating every value. A .env file in the working directory is loaded first if present (development convenience).

func LoadFromLookup

func LoadFromLookup(lookup func(string) (string, bool)) (Config, error)

LoadFromLookup reads the configuration from an arbitrary lookup function, applying defaults and validating every value. On any problem it returns a single error listing every issue found.

Jump to

Keyboard shortcuts

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