config

package
v0.6.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvIntWithDefault

func GetEnvIntWithDefault(key string, defaultValue int) int

GetEnvIntWithDefault returns an environment variable as int or a default

func GetEnvWithDefault

func GetEnvWithDefault(key, defaultValue string) string

GetEnvWithDefault returns an environment variable value or a default

Types

type Config

type Config struct {
	// Server settings
	Port     int      `json:"port"`
	AdminKey string   `json:"admin_key"`
	Admins   []string `json:"admins"`

	// TLS settings
	TLSCertFile string `json:"tls_cert_file"`
	TLSKeyFile  string `json:"tls_key_file"`

	// Database settings
	DBPath string `json:"db_path"`

	// Logging
	LogLevel string `json:"log_level"`

	// JWT settings
	JWTSecret string `json:"jwt_secret"`

	// Config directory
	ConfigDir string `json:"config_dir"`

	// Ban history gaps feature
	BanGapsHistory bool `json:"ban_gaps_history"`

	// Plugin settings
	PluginRegistryURL string `json:"plugin_registry_url"`
}

Config holds all application configuration

func LoadConfig

func LoadConfig(configDir string) (*Config, error)

LoadConfig loads configuration from environment variables, .env files, and config files

func (*Config) GetWebSocketScheme

func (c *Config) GetWebSocketScheme() string

GetWebSocketScheme returns the appropriate WebSocket scheme based on TLS configuration

func (*Config) IsTLSEnabled

func (c *Config) IsTLSEnabled() bool

IsTLSEnabled returns true if both TLS certificate and key files are configured

Jump to

Keyboard shortcuts

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