config

package
v0.0.0-...-dda4347 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DataDir = paths.DataDir(paths.CurrentOS())
	LogDir  = paths.LogDir(paths.CurrentOS())
)

Functions

func ReadAgentConfig

func ReadAgentConfig(c AgentConfigReader, agentId string) error

ReadAgentConfig is a helper to read either machine or controller agent config, whichever is there. Machine config gets precedence.

Types

type AgentConf

type AgentConf interface {
	// DataDir returns the directory where this agent should store its data.
	DataDir() string

	// ReadConfig reads the agent's config from its config file.
	ReadConfig(tag string) error

	// CurrentConfig returns the agent config for this agent.
	CurrentConfig() agent.Config

	// ChangeConfig modifies this configuration using the given mutator.
	ChangeConfig(change agent.ConfigMutator) error
}

AgentConf is an interface that provides access to the agent's configuration.

type AgentConfig

type AgentConfig struct {
	RawDataDir string
	// contains filtered or unexported fields
}

AgentConfig implements AgentConf, it is expected to be embedded in other types that need to implement AgentConf.

func NewAgentConfig

func NewAgentConfig(dataDir string) *AgentConfig

NewAgentConfig returns a new AgentConfig.

func NewAgentConfigWithConfigSetterWriter

func NewAgentConfigWithConfigSetterWriter(dataDir string, config agent.ConfigSetterWriter) *AgentConfig

NewAgentConfig returns a new AgentConfig.

func (*AgentConfig) ChangeConfig

func (c *AgentConfig) ChangeConfig(change agent.ConfigMutator) error

ChangeConfig modifies this configuration using the given mutator.

func (*AgentConfig) CurrentConfig

func (c *AgentConfig) CurrentConfig() agent.Config

CurrentConfig returns the agent config for this agent.

func (*AgentConfig) DataDir

func (c *AgentConfig) DataDir() string

DataDir returns the directory where this agent should store its data.

func (*AgentConfig) ReadConfig

func (c *AgentConfig) ReadConfig(tag string) error

ReadConfig reads the agent's config from its config file.

type AgentConfigReader

type AgentConfigReader interface {
	// ReadConfig reads the config for the given tag from disk.
	ReadConfig(tag string) error
}

AgentConfigWriter encapsulates disk I/O operations with the agent config.

type AgentConfigWriter

type AgentConfigWriter interface {
	AgentConfigReader
	// ChangeConfig executes the given agent.ConfigMutator in a
	// thread-safe context.
	ChangeConfig(agent.ConfigMutator) error
	// CurrentConfig returns a copy of the in-memory agent config.
	CurrentConfig() agent.Config
}

AgentConfigWriter encapsulates disk I/O operations with the agent config.

Jump to

Keyboard shortcuts

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