config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: AGPL-3.0 Imports: 19 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

This section is empty.

Variables

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

Functions

func GetLoadsConfigGraph

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

func GetLoadsFromConfig

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

func GetNodesFromConfig

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

func GetVersion

func GetVersion() string

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 {
	// 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"`

	// 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"`

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

	// Enables containers support.
	// Default: true
	Containers bool `json:"containers"`

	// Enables or disables the reverse proxy.
	// Default: false
	ProxyEnabled bool `json:"proxy_enabled"`

	// Local Caddy proxy URL.
	// Default: localhost:2019
	LocalCaddyUrl string `json:"local_caddy_url"`

	// Master Caddy proxy URL.
	// Default: localhost:2019
	MasterCaddyUrl string `json:"master_caddy_url"`

	// Registries holds authentication configuration for container registries.
	// Default: empty (anonymous pulls)
	Registries []RegistryConfig `json:"registries,omitempty"`

	// Multicast address for herd communication.
	HerdMcastAddress string `json:"herd_mcast_address"`

	// 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"`

	// Etcd mode: "server" to run embedded etcd server, "client" to connect to external etcd.
	// Valid values: "server", "client"
	// Default: server
	EtcdMode string `json:"etcd_mode"`

	// Etcd endpoints to connect to when mode is "client".
	// Example: ["http://node1:2379", "http://node2:2379"]
	// Default: empty (uses EtcdListenClientUrl when in server mode)
	EtcdEndpoints []string `json:"etcd_endpoints"`

	// Etcd client URL.
	// Default: http://<main-network-interface-ip>:2379 (auto-detected)
	EtcdListenClientUrl string `json:"etcd_listen_client_url"`

	// Etcd peer URL.
	// Default: http://<main-network-interface-ip>:2380 (auto-detected)
	EtcdListenPeerUrl string `json:"etcd_listen_peer_url"`

	// Expected members of the cluster, and this is how to reach them via peer URLs.
	// Left empty for single-node cluster
	// Default: empty
	EtcdInitialCluster string `json:"etcd_initial_cluster"`
}

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

type Config

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

	// Client config
	Nodes     map[string]*common.NodeConfig `json:"nodes"`
	Discovery DiscoveryConfig               `json:"discovery"`

	// Agent config
	Agent AgentConfig `json:"agent"`
	Loads LoadsConfig `json:"loads"`

	// Autoconfigured network Config
	NetworkConfig NetworkConfig `json:"-"`
	// 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) 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 DiscoveryConfig

type DiscoveryConfig struct {
	MdnsEnabled bool `json:"mdns"`
}

type LoadsConfig

type LoadsConfig map[string]common.LoadConfig

type NetworkConfig

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

type RegistryAuth

type RegistryAuth struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Token    string `json:"token,omitempty"`
}

RegistryAuth holds authentication credentials for a container registry. Token OR Username/Password should be set, not both.

type RegistryConfig

type RegistryConfig struct {
	Host     string       `json:"host"` // Registry host (e.g., "ghcr.io", "docker.io", "registry.example.com:5000")
	Auth     RegistryAuth `json:"auth"`
	Insecure bool         `json:"insecure,omitempty"` // Allow HTTP instead of HTTPS
}

RegistryConfig holds configuration for a container registry.

Jump to

Keyboard shortcuts

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