config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config contains the definition of the application config structure and logic required to load and update it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateConfig added in v0.0.32

func UpdateConfig(updateFn func(*Config)) error

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

func UpdateConfigAtPath(configPath string, updateFn func(*Config)) error

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"`
	AllowPrivateRegistryIp bool                `yaml:"allow_private_registry_ip"`
	CACertificatePath      string              `yaml:"ca_certificate_path,omitempty"`
	OTEL                   OpenTelemetryConfig `yaml:"otel,omitempty"`
}

Config represents the configuration of the application.

func GetConfig

func GetConfig() *Config

GetConfig is a Singleton that returns the application configuration.

func LoadOrCreateConfig

func LoadOrCreateConfig() (*Config, error)

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

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

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.

Jump to

Keyboard shortcuts

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