config

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultConfigFileName is the default name for the config file
	DefaultConfigFileName = ".unboundCLI.json"

	// Environment variable names
	EnvAPIKey    = "UNBOUND_CLI_API_KEY"
	EnvAPISecret = "UNBOUND_CLI_API_SECRET"
	EnvBaseURL   = "UNBOUND_CLI_BASE_URL"
	EnvInsecure  = "UNBOUND_CLI_INSECURE"

	// AdguardHome specific environment variables
	EnvAdguardEnabled  = "ADGUARD_ENABLED"
	EnvAdguardUsername = "ADGUARD_USERNAME"
	EnvAdguardPassword = "ADGUARD_PASSWORD"
	EnvAdguardBaseURL  = "ADGUARD_BASE_URL"
	EnvAdguardInsecure = "ADGUARD_INSECURE"
)

Variables

This section is empty.

Functions

func GetDefaultConfigPath

func GetDefaultConfigPath() (string, error)

GetDefaultConfigPath returns the default path for the config file

func LoadConfig

func LoadConfig() (api.Config, error)

LoadConfig loads the API configuration from environment variables, Viper, or a file

func SaveConfig

func SaveConfig(config api.Config, filePath string) error

SaveConfig saves the API configuration to a file

func SaveExtendedConfig added in v0.1.0

func SaveExtendedConfig(cfg ExtendedConfig, path string) error

SaveExtendedConfig saves the extended configuration (including AdguardHome) to a file

Types

type AdguardConfig added in v0.1.0

type AdguardConfig struct {
	Enabled     bool   `json:"enabled" mapstructure:"enabled"`
	Username    string `json:"username,omitempty" mapstructure:"username"`
	Password    string `json:"password,omitempty" mapstructure:"password"`
	BaseURL     string `json:"base_url,omitempty" mapstructure:"base_url"`
	Insecure    bool   `json:"insecure" mapstructure:"insecure"`
	Description string `json:"description" mapstructure:"description"`
}

AdguardConfig represents configuration specific to AdguardHome integration

func LoadAdguardConfig added in v0.1.0

func LoadAdguardConfig() (AdguardConfig, error)

LoadAdguardConfig loads AdguardHome-specific configuration from environment variables, viper, or config file

func (AdguardConfig) GetAdguardAPIConfig added in v0.1.0

func (a AdguardConfig) GetAdguardAPIConfig() api.AdguardConfig

GetAdguardAPIConfig creates an AdguardConfig from the configuration suitable for API client use

type ExtendedConfig added in v0.1.0

type ExtendedConfig struct {
	api.Config `json:",inline" mapstructure:",squash"`
	Adguard    AdguardConfig `json:"adguard" mapstructure:"adguard"`
}

ExtendedConfig represents the full application configuration including AdguardHome

Jump to

Keyboard shortcuts

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