config

package
v1.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemporalModeEmbedded = "embedded"
	TemporalModeExternal = "external"
)

Temporal deployment modes

View Source
const (
	AgentTypeFilesystem = "filesystem"
	AgentTypeDatabase   = "database"
	AgentTypeKubernetes = "kubernetes"
)

Agent types (agents.agent_type); each has its own binary and data directory

View Source
const SystemAgentDataDir = "/var/lib/fallbck/agent"

SystemAgentDataDir is where packaged installations (systemd/OpenRC services) keep the agent state; the service units point at it explicitly.

View Source
const SystemDBAgentDataDir = "/var/lib/fallbck/db-agent"

SystemDBAgentDataDir is the state directory of the retired standalone fallbck-db-agent; `fallbck-agent migrate-db-agent` reads it by default

Variables

AgentTypes lists the known agent types

Functions

func AgentDirName added in v0.6.0

func AgentDirName(agentType string) string

AgentDirName is the per-type directory name under /var/lib/fallbck and ~/.fallbck

func DefaultAgentDataDir added in v0.3.1

func DefaultAgentDataDir() string

DefaultAgentDataDir returns the agent data directory used when none is configured: FALLBCK_AGENT_DATA_DIR if set, the system directory when running as root (the packaged case), otherwise ~/.fallbck/agent for unprivileged use.

func DefaultAgentDataDirFor added in v0.6.0

func DefaultAgentDataDirFor(agentType string) string

DefaultAgentDataDirFor is DefaultAgentDataDir for a given agent type

func DetectTimezone added in v0.7.2

func DetectTimezone() string

DetectTimezone finds the host's IANA timezone name: the TZ environment variable, /etc/timezone (Debian), or the /etc/localtime symlink target; UTC when nothing is determinable (the common case in containers without TZ set).

func EnvLogLevelSet added in v0.6.2

func EnvLogLevelSet() bool

EnvLogLevelSet reports whether the environment picked a log level (DEBUG or FALLBCK_LOG_LEVEL); when it did, it outranks the config file's log_level.

func LogLevel added in v0.6.0

func LogLevel() slog.Level

LogLevel returns the process log level: FALLBCK_LOG_LEVEL (debug|info|warn|error) or, for quick troubleshooting, DEBUG=true. Defaults to info.

func ParseLogLevel added in v0.6.2

func ParseLogLevel(s string) (slog.Level, bool)

ParseLogLevel maps a level name (debug, info, warn, error) to a slog level

func SystemAgentDataDirFor added in v0.6.0

func SystemAgentDataDirFor(agentType string) string

SystemAgentDataDirFor returns the packaged data directory for an agent type: /var/lib/fallbck/<dir> on Unix, %ProgramData%\fallbck\<dir> on Windows

func UpdateAgentToken added in v0.6.0

func UpdateAgentToken(filePath, token string, expires time.Time) error

UpdateAgentToken rewrites only the token fields of the config file, keeping every other setting (including values that came from the environment) out of the file.

Types

type AgentConfig

type AgentConfig struct {
	AgentID  string `yaml:"agent_id" json:"agent_id"`
	Hostname string `yaml:"hostname" json:"hostname"`
	// ServerURL is the FallBCK server (reverse proxy) URL; HTTP API and Temporal gRPC
	// are both reached through it
	ServerURL string `yaml:"server_url" json:"server_url"`
	DataDir   string `yaml:"data_dir" json:"data_dir"`
	TaskQueue string `yaml:"task_queue" json:"task_queue"`
	Namespace string `yaml:"namespace" json:"namespace"`
	// AuthToken is the agent bearer token issued at enrollment
	AuthToken      string    `yaml:"auth_token" json:"-"`
	TokenExpiresAt time.Time `yaml:"token_expires_at" json:"token_expires_at"`
	// ServerCACertPath optionally trusts a private CA for ServerURL
	ServerCACertPath   string `yaml:"server_ca_cert_path" json:"server_ca_cert_path"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify" json:"insecure_skip_verify"`
	// VSS (Windows only) backs up from a Volume Shadow Copy of each volume so open
	// and locked files are read consistently; default true
	VSS *bool `yaml:"vss,omitempty" json:"vss,omitempty"`
	// EnrollmentKey triggers self-enrollment on first start
	EnrollmentKey string `yaml:"enrollment_key" json:"-"`
	// LogLevel sets the agent's base log level (debug, info, warn, error); the DEBUG /
	// FALLBCK_LOG_LEVEL environment variables take precedence, and the server can
	// raise the level to debug at runtime (per-agent toggle in the web UI)
	LogLevel string `yaml:"log_level,omitempty" json:"log_level,omitempty"`
	// DBBackup configures database jobs on fallbck-agent (spool, tools, credential profiles)
	DBBackup dbbackup.Config `yaml:"db_backup,omitempty" json:"db_backup"`
	// DockerBackup configures Docker host jobs on fallbck-agent (socket, volume
	// access mode, helper image)
	DockerBackup dockerbackup.Config `yaml:"docker_backup,omitempty" json:"docker_backup"`
}

AgentConfig is the fallbck-agent configuration

func DefaultAgentConfig

func DefaultAgentConfig() *AgentConfig

DefaultAgentConfig returns the defaults for fallbck-agent

func LoadAgentConfig

func LoadAgentConfig(filePath string) (*AgentConfig, error)

LoadAgentConfig loads the YAML file (if any) and applies environment overrides

func ReadAgentConfigFile added in v0.6.0

func ReadAgentConfigFile(filePath string) (*AgentConfig, error)

ReadAgentConfigFile loads only the YAML file (no defaults, no environment); it reports os.ErrNotExist when the file is missing.

func (*AgentConfig) Save

func (c *AgentConfig) Save(path string) error

Save writes the agent configuration to path with owner-only permissions (it holds the token)

func (*AgentConfig) ServerTLSConfig added in v0.9.1

func (c *AgentConfig) ServerTLSConfig() (*tls.Config, error)

ServerTLSConfig builds the client TLS configuration for ServerURL: the operator's private CA (ServerCACertPath) and/or InsecureSkipVerify. Used by every connection the agent makes to the server (enrollment, HTTP API, Temporal and tunnel gRPC).

func (*AgentConfig) UseVSS added in v0.9.5

func (c *AgentConfig) UseVSS() bool

UseVSS reports whether Windows backups read from a Volume Shadow Copy (default true)

type AgentTokensConfig

type AgentTokensConfig struct {
	TTL time.Duration `yaml:"ttl" json:"ttl"`
}

AgentTokensConfig configures agent bearer tokens

type AuthConfig

type AuthConfig struct {
	OIDC       OIDCConfig    `yaml:"oidc" json:"oidc"`
	SessionTTL time.Duration `yaml:"session_ttl" json:"session_ttl"`
	// InsecureDisable turns admin authentication off. Development only; the server
	// refuses it unless started with --dev.
	InsecureDisable bool `yaml:"insecure_disable" json:"insecure_disable"`
}

AuthConfig configures administrator authentication

type DatabaseConfig

type DatabaseConfig struct {
	URL             string        `yaml:"url" json:"url"`
	MaxOpenConns    int           `yaml:"max_open_conns" json:"max_open_conns"`
	MaxIdleConns    int           `yaml:"max_idle_conns" json:"max_idle_conns"`
	ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime" json:"conn_max_lifetime"`
	AutoMigrate     bool          `yaml:"auto_migrate" json:"auto_migrate"`
}

DatabaseConfig configures the application PostgreSQL pool

type EmbeddedTemporalConfig

type EmbeddedTemporalConfig struct {
	BindIP string `yaml:"bind_ip" json:"bind_ip"`
	// PortBase is the loopback frontend port; the other services use PortBase+1..+6
	PortBase int `yaml:"port_base" json:"port_base"`
	// DatabaseURL defaults to the application database URL (database name is replaced)
	DatabaseURL string `yaml:"database_url" json:"database_url"`
	// HistoryShards is immutable after the first start
	HistoryShards int32         `yaml:"history_shards" json:"history_shards"`
	Retention     time.Duration `yaml:"retention" json:"retention"`
	// ClusterName is immutable after the first start (default "fallbck"); set it to the
	// existing cluster name when adopting databases created by another Temporal deployment
	ClusterName string `yaml:"cluster_name" json:"cluster_name"`
}

EmbeddedTemporalConfig configures the in-process Temporal server

type OIDCConfig

type OIDCConfig struct {
	Issuer       string   `yaml:"issuer" json:"issuer"`
	ClientID     string   `yaml:"client_id" json:"client_id"`
	ClientSecret string   `yaml:"client_secret" json:"-"`
	Scopes       []string `yaml:"scopes" json:"scopes"`
	// AllowedGroups restricts login to identities whose groups claim contains one of these (empty = any)
	AllowedGroups []string `yaml:"allowed_groups" json:"allowed_groups"`
	// AllowedEmails restricts login to these email addresses (empty = any)
	AllowedEmails []string `yaml:"allowed_emails" json:"allowed_emails"`
	// GroupsClaim is the ID token claim carrying group membership (default "groups")
	GroupsClaim string `yaml:"groups_claim" json:"groups_claim"`
}

OIDCConfig configures admin login through an OpenID Connect provider

func (OIDCConfig) Enabled

func (c OIDCConfig) Enabled() bool

Enabled reports whether the OIDC configuration is populated

func (OIDCConfig) Validate

func (c OIDCConfig) Validate() error

Validate checks the configuration is usable

type SecurityConfig added in v0.13.0

type SecurityConfig struct {
	// MasterKeyFile holds 64 hex characters; generated on first start when missing
	// (default <data_dir>/master.key). Back it up together with the database: the
	// sealed secrets, including backup encryption keys, are unreadable without it.
	MasterKeyFile string `yaml:"master_key_file" json:"master_key_file"`
	// MasterKey is the key itself (64 hex characters) for container deployments
	// (FALLBCK_MASTER_KEY); it takes precedence over the file
	MasterKey string `yaml:"master_key,omitempty" json:"-"`
}

SecurityConfig holds the server master key that seals stored secrets (PBS API tokens, backup encryption keys) at rest

type ServerConfig

type ServerConfig struct {
	// HTTPPort / HTTPBind: the single plaintext h2c listener behind the reverse proxy
	HTTPPort int    `yaml:"http_port" json:"http_port"`
	HTTPBind string `yaml:"http_bind" json:"http_bind"`
	// PublicURL is the reverse proxy's externally reachable URL (OIDC redirect,
	// install script, enrollment response)
	PublicURL string `yaml:"public_url" json:"public_url"`
	// TrustedProxies are the CIDRs of reverse proxies whose X-Forwarded-For entries are
	// believed when determining a client's IP (default: loopback and private ranges)
	TrustedProxies []string `yaml:"trusted_proxies" json:"trusted_proxies"`
	// JWTSecret signs sessions, agent tokens and tickets; empty = generated into
	// <data_dir>/jwt.secret on first start
	JWTSecret string `yaml:"jwt_secret" json:"jwt_secret"`
	DataDir   string `yaml:"data_dir" json:"data_dir"`
	// AgentCABundlePath optionally points at a PEM bundle agents should trust for the
	// public URL (private CAs); it is handed out at enrollment
	AgentCABundlePath string `yaml:"agent_ca_bundle_path" json:"agent_ca_bundle_path"`
	// Timezone (IANA name) governs cron schedules and next-run display; empty =
	// auto-detect from TZ / the host zone, falling back to UTC
	Timezone string `yaml:"timezone" json:"timezone"`

	Auth        AuthConfig           `yaml:"auth" json:"auth"`
	AgentTokens AgentTokensConfig    `yaml:"agent_tokens" json:"agent_tokens"`
	Database    DatabaseConfig       `yaml:"database" json:"database"`
	Temporal    TemporalServerConfig `yaml:"temporal" json:"temporal"`
	Security    SecurityConfig       `yaml:"security" json:"security"`
}

ServerConfig is the fallbck-server configuration

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

DefaultServerConfig returns the defaults for fallbck-server

func LoadServerConfig

func LoadServerConfig(filePath string) (*ServerConfig, error)

LoadServerConfig loads the YAML file (if any) and applies environment overrides

func (*ServerConfig) EffectiveJWTSecretFile added in v0.14.12

func (c *ServerConfig) EffectiveJWTSecretFile() string

EffectiveJWTSecretFile is where a generated JWT secret lives

func (*ServerConfig) EffectiveMasterKeyFile added in v0.13.0

func (c *ServerConfig) EffectiveMasterKeyFile() string

EffectiveMasterKeyFile is the configured path or the default under the data directory

func (*ServerConfig) ProxyURL

func (c *ServerConfig) ProxyURL() string

ProxyURL returns the externally reachable base URL of the PBS proxy gateway. The proxy is served by the main HTTP listener, so it lives under PublicURL.

func (*ServerConfig) PublicURLIsHTTPS

func (c *ServerConfig) PublicURLIsHTTPS() bool

PublicURLIsHTTPS reports whether the public URL is served over TLS (cookie Secure flag)

func (*ServerConfig) ScheduleLocation added in v0.7.2

func (c *ServerConfig) ScheduleLocation() *time.Location

ScheduleLocation loads the configured timezone (UTC on any problem)

func (*ServerConfig) Validate

func (c *ServerConfig) Validate(dev bool) error

Validate checks the server configuration for consistency. dev reports whether the server was started with --dev (relaxes the authentication requirement).

type TemporalConfig

type TemporalConfig struct {
	HostPort           string `yaml:"host_port" json:"host_port"`
	Namespace          string `yaml:"namespace" json:"namespace"`
	EnableTLS          bool   `yaml:"enable_tls" json:"enable_tls"`
	CACertPath         string `yaml:"ca_cert_path" json:"ca_cert_path"`
	ClientCertPath     string `yaml:"client_cert_path" json:"client_cert_path"`
	ClientKeyPath      string `yaml:"client_key_path" json:"client_key_path"`
	ServerName         string `yaml:"server_name" json:"server_name"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify" json:"insecure_skip_verify"`
}

TemporalConfig is a Temporal *client* configuration (used for an external cluster)

func (*TemporalConfig) BuildTLSConfig

func (tc *TemporalConfig) BuildTLSConfig() (*tls.Config, error)

BuildTLSConfig builds the client TLS configuration for an external Temporal cluster

type TemporalServerConfig

type TemporalServerConfig struct {
	Mode      string                 `yaml:"mode" json:"mode"`
	Namespace string                 `yaml:"namespace" json:"namespace"`
	Embedded  EmbeddedTemporalConfig `yaml:"embedded" json:"embedded"`
	External  TemporalConfig         `yaml:"external" json:"external"`
	UI        TemporalUIConfig       `yaml:"ui" json:"ui"`
}

TemporalServerConfig selects and configures the Temporal cluster the server uses

type TemporalUIConfig

type TemporalUIConfig struct {
	Enabled bool `yaml:"enabled" json:"enabled"`
	// Port is the loopback port the UI server listens on
	Port int `yaml:"port" json:"port"`
}

TemporalUIConfig configures the embedded Temporal Web UI (served under /temporal/)

Jump to

Keyboard shortcuts

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