Documentation
¶
Overview ¶
Package config contains the definition of the application config structure and logic required to load and update it.
Index ¶
- Constants
- func DetectRegistryType(input string) (registryType string, cleanPath string)
- func GetRegistryConfig() (url, localPath string, allowPrivateIP bool, registryType string)
- func SetRegistryFile(registryPath string) error
- func SetRegistryURL(registryURL string, allowPrivateRegistryIp bool) error
- func UnsetRegistry() error
- func UpdateConfig(updateFn func(*Config)) error
- func UpdateConfigAtPath(configPath string, updateFn func(*Config)) error
- type Clients
- type Config
- type OpenTelemetryConfig
- type Secrets
Constants ¶
const ( // RegistryTypeFile represents a local file registry RegistryTypeFile = "file" // RegistryTypeURL represents a remote URL registry RegistryTypeURL = "url" )
Variables ¶
This section is empty.
Functions ¶
func DetectRegistryType ¶ added in v0.2.4
DetectRegistryType determines if input is a URL or file path and returns cleaned path
func GetRegistryConfig ¶ added in v0.2.4
GetRegistryConfig returns current registry configuration
func SetRegistryFile ¶ added in v0.2.4
SetRegistryFile validates and sets a local registry file
func SetRegistryURL ¶ added in v0.2.4
SetRegistryURL validates and sets a registry URL
func UnsetRegistry ¶ added in v0.2.4
func UnsetRegistry() error
UnsetRegistry resets registry configuration to defaults
func UpdateConfig ¶ added in v0.0.32
UpdateConfig locks a separate lock file, reads from disk, applies the changes from the anonymous function, writes to disk and unlocks the file.
func UpdateConfigAtPath ¶ added in v0.0.45
UpdateConfigAtPath locks a separate lock file, reads from disk, applies the changes from the anonymous function, writes to disk and unlocks the file. If configPath is empty, it uses the default path.
Types ¶
type Clients ¶
type Clients struct { RegisteredClients []string `yaml:"registered_clients"` AutoDiscovery bool `yaml:"auto_discovery"` // Deprecated: kept for migration purposes only }
Clients contains settings for client configuration.
type Config ¶
type Config struct { Secrets Secrets `yaml:"secrets"` Clients Clients `yaml:"clients"` RegistryUrl string `yaml:"registry_url"` LocalRegistryPath string `yaml:"local_registry_path"` AllowPrivateRegistryIp bool `yaml:"allow_private_registry_ip"` CACertificatePath string `yaml:"ca_certificate_path,omitempty"` OTEL OpenTelemetryConfig `yaml:"otel,omitempty"` DefaultGroupMigration bool `yaml:"default_group_migration,omitempty"` }
Config represents the configuration of the application.
func GetConfig ¶
func GetConfig() *Config
GetConfig is a Singleton that returns the application configuration.
func LoadOrCreateConfig ¶
LoadOrCreateConfig fetches the application configuration. If it does not already exist - it will create a new config file with default values.
func LoadOrCreateConfigWithPath ¶ added in v0.0.45
LoadOrCreateConfigWithPath fetches the application configuration from a specific path. If configPath is empty, it uses the default path. If it does not already exist - it will create a new config file with default values.
type OpenTelemetryConfig ¶ added in v0.1.2
type OpenTelemetryConfig struct { Endpoint string `yaml:"endpoint,omitempty"` SamplingRate float64 `yaml:"sampling-rate,omitempty"` EnvVars []string `yaml:"env-vars,omitempty"` }
OpenTelemetryConfig contains the settings for OpenTelemetry configuration.
type Secrets ¶
type Secrets struct { ProviderType string `yaml:"provider_type"` SetupCompleted bool `yaml:"setup_completed"` }
Secrets contains the settings for secrets management.
func (*Secrets) GetProviderType ¶ added in v0.0.33
func (s *Secrets) GetProviderType() (secrets.ProviderType, error)
GetProviderType returns the secrets provider type from the environment variable or application config. It first checks the TOOLHIVE_SECRETS_PROVIDER environment variable, and falls back to the config file. Returns ErrSecretsNotSetup if secrets have not been configured yet.
func (*Secrets) GetProviderTypeWithEnv ¶ added in v0.2.13
GetProviderTypeWithEnv returns the secrets provider type using the provided environment reader. This method allows for dependency injection of environment variable access for testing.