config

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultSocketGroup = "realm"

Variables

View Source
var (
	BuildGitCommit string
	Version        = "dev"
)

Functions

func EvalVars added in v0.2.4

func EvalVars[T any](object *T, vars map[string]string) error

EvalVars replaces every occurrence of {{var}} with the corresponding value from vars, mutating object in place. object must be a pointer.

func GetJobs added in v0.2.5

func GetJobs(jobsFilter ...string) map[string]*common.Job

func GetLoadsConfigGraph

func GetLoadsConfigGraph() graph.Graph[string, string]

func GetLoadsFromConfig

func GetLoadsFromConfig(loadsFilter ...string) map[string]*common.Load

func GetNodes added in v0.2.4

func GetNodes(nodesFilter ...string) map[string]*common.Node

func GetVersion

func GetVersion() string

func ResetJobsConfig added in v0.2.5

func ResetJobsConfig()

func ResetLoadsConfig added in v0.1.2

func ResetLoadsConfig()

func ResetNodesConfig added in v0.1.2

func ResetNodesConfig()

Types

type AgentConfig added in v0.2.0

type AgentConfig struct {
	// Address to bind the agent API.
	// Default: 127.0.0.1
	ListenAddress string `json:"listen_address"`

	// Port to bind the agent API.
	// Default: 9000
	ListenPort int `json:"listen_port"`

	// Path to an additional unix socket to expose the agent API on.
	// When empty, the API is only served over TCP.
	// Default: empty (disabled)
	ListenSocket string `json:"listen_socket"`

	// Group given ownership of the unix socket, as a group name or a numeric
	// gid.
	// Default: realm
	ListenSocketGroup string `json:"listen_socket_group"`

	// Disable the TCP listener, serving the agent API only over the unix
	// socket configured in ListenSocket.
	// Default: false (TCP enabled)
	DisableTCP bool `json:"disable_tcp"`

	// Path to CNI plugins.
	// Default: /usr/lib/cni (Linux) or %ProgramData%\realm\cni (Windows)
	CniPath string `json:"cni_path"`

	// Name of the ZFS pool for container volumes.
	// Default: realm_volumes
	VolumesPool string `json:"volumes_pool"`

	// Enable ZFS for volume management.
	// When true, uses ZFS-based volume implementation.
	// When false, uses directory-based volume implementation.
	// Default: false
	ZFS bool `json:"zfs"`

	// Log output format.
	// Valid values: "text", "json"
	// Default: text
	LogFormat string `json:"log_format"`

	// Containerd socket path.
	// Default: /run/containerd/containerd.sock (Linux) or npipe://./pipe/containerd-containerd (Windows)
	ContainerdSock string `json:"containerd_sock"`

	// Containerd namespace to use.
	// Default: realm
	ContainerdNamespace string `json:"containerd_namespace"`

	// Artifacts repository (experimental)
	Artifacts ArtifactsRepository `json:"artifacts"`
}

AgentConfig holds the configuration for the realm agent. All fields are optional and have platform-specific or sensible defaults.

type ArtifactsRepository added in v0.2.4

type ArtifactsRepository struct {
	AuthRequired bool `json:"auth_required"`

	// Path to raw artifacts
	RawArtifactsPath *string `json:"raw_path,omitempty"`
}

ArtifactRepositoryConfig

type Config

type Config struct {
	// Path to store realm data (ID file, database, logs, mesh configs...).
	// Default: /var/lib/realm (Linux) or %ProgramData%\realm (Windows)
	DataPath string `json:"data_path"`

	// Minimum log level, for both the agent and the client.
	// Valid values: "debug", "info", "warn" (or "warning"), "error"
	// Overridden by the LOG_LEVEL environment variable when set.
	// Default: info
	LogLevel string `json:"log_level"`

	Agent AgentConfig `json:"agent"`
	Nodes NodesConfig `json:"nodes"`
	Loads LoadsConfig `json:"loads"`
	Jobs  JobsConfig  `json:"jobs"`

	// Autoconfigured network Config
	NetworkConfig NetworkConfig `json:"-"`

	MeshConfig *MeshConfig `json:"mesh,omitempty"`
	// contains filtered or unexported fields
}

func Init

func Init(configFilePath *string) (*Config, error)

Init reads configuration from file or environment variables. If configFilePath is provided, it will be used instead of the default locations.

func InitFromBuffer

func InitFromBuffer(buffer string) (*Config, error)

func (*Config) GetJob added in v0.2.5

func (c *Config) GetJob(jobName string) *common.Job

func (*Config) GetLoads added in v0.1.2

func (c *Config) GetLoads(loadsFilter ...string) map[string]*common.Load

func (*Config) GetLoadsGraph added in v0.1.2

func (c *Config) GetLoadsGraph() graph.Graph[string, string]

func (*Config) GetNodes added in v0.1.2

func (c *Config) GetNodes(nodesFilter ...string) map[string]*common.Node

func (Config) NeedsCloudInit added in v0.1.8

func (c Config) NeedsCloudInit() bool

type JobsConfig added in v0.2.5

type JobsConfig map[string]common.JobConfig

type LoadsConfig

type LoadsConfig map[string]common.LoadConfig

type MeshConfig added in v0.2.2

type MeshConfig struct {
	ServerUrl string        `json:"server"`
	Port      uint16        `json:"port,omitempty"` // Default: 5000
	Transport MeshTransport `json:"transport,omitempty"`
	LinkCode  string        `json:"link_code"`
}

type MeshTransport added in v0.2.2

type MeshTransport string
const (
	MeshTransportUDP       MeshTransport = "udp"
	MeshTransportWebsocket MeshTransport = "websocket"
)

type NetworkConfig

type NetworkConfig struct {
	IPAddress *net.IP
	Iface     *net.Interface
}

type NodesConfig added in v0.2.5

type NodesConfig map[string]*common.NodeConfig

Jump to

Keyboard shortcuts

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