config

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 6 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   ServerConfig   `json:"server"`
	Security SecurityConfig `json:"security"`
	Libvirt  LibvirtConfig  `json:"libvirt"`
	Logging  LoggingConfig  `json:"logging"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadConfig

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

LoadConfig loads configuration from file and environment variables

func (*Config) GetServerAddress

func (c *Config) GetServerAddress() string

GetServerAddress returns the full server address

func (*Config) SaveConfig

func (c *Config) SaveConfig(path string) error

SaveConfig saves the configuration to a file

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type LibvirtConfig

type LibvirtConfig struct {
	URI           string `json:"uri"`
	ISOPool       string `json:"iso_pool"`
	TemplatePool  string `json:"template_pool"`
	ImagePoolPath string `json:"image_pool_path"`
}

LibvirtConfig represents libvirt-related configuration

type LoggingConfig

type LoggingConfig struct {
	Level  string `json:"level"`  // DEBUG, INFO, WARN, ERROR, FATAL
	Format string `json:"format"` // json, text
}

LoggingConfig represents logging configuration

type SecurityConfig

type SecurityConfig struct {
	RateLimitRequests int    `json:"rate_limit_requests"` // requests per minute
	RateLimitBurst    int    `json:"rate_limit_burst"`    // burst size
	PassphraseHash    string `json:"passphrase_hash"`     // bcrypt hash of web UI passphrase
}

SecurityConfig represents security-related configuration

type ServerConfig

type ServerConfig struct {
	Host         string `json:"host"`
	Port         int    `json:"port"`
	ReadTimeout  int    `json:"read_timeout"`  // seconds
	WriteTimeout int    `json:"write_timeout"` // seconds
}

ServerConfig represents server-specific configuration

Jump to

Keyboard shortcuts

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