config

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config manages proximo's persisted user configuration and the on-disk paths it uses (TLS material, the embedded stack, etc.).

Index

Constants

View Source
const (
	// DefaultTLD is the default top-level domain used for local routing.
	// ".test" is reserved by RFC 6761 and never collides with mDNS (".local").
	DefaultTLD = "test"

	// DNSPort is the loopback UDP host port the DNS server is published on. A
	// high port avoids any privileged bind to :53; 5353 is intentionally
	// avoided because macOS mDNSResponder (Bonjour) already binds it.
	DNSPort = 5354

	// ObsHubPort is the loopback TCP host port the metrics hub is published on
	// (only when the observability profile is active) so the one-shot bootstrap
	// can reach the hub API directly, without depending on DNS/Traefik/TLS being
	// converged yet. A high, uncommon port avoids colliding with the hub's
	// default 8090.
	ObsHubPort = 48090
)

Variables

This section is empty.

Functions

func DataDir added in v0.3.0

func DataDir() (string, error)

DataDir returns (creating if needed) the directory holding the stack's bind-mounted runtime data (Traefik routes/certs, Beszel metrics). It is the host side of the data bind mounts the materialized compose declares.

func Dir

func Dir() (string, error)

Dir returns (creating if needed) the per-user state home at $HOME/.proximo.

func HomePath added in v0.4.0

func HomePath() (string, error)

HomePath resolves the state-home path ($HOME/.proximo) without creating it, so callers that only need the location (RemoveHome, `config ca-path`) don't trigger side effects.

func NormalizeTLD

func NormalizeTLD(raw string) (string, error)

NormalizeTLD validates and normalizes a user-supplied TLD: it strips a leading dot, lowercases, enforces a single DNS label, and rejects reserved values.

func RemoveHome added in v0.3.0

func RemoveHome() error

RemoveHome deletes the entire ~/.proximo state home (CA, secret, config, materialized stack, and bind-mounted data). uninstall calls it after the stack is down and host trust/resolver are reversed, for a full reversal. It resolves the path without creating it.

func SubDir

func SubDir(name string) (string, error)

SubDir returns (creating if needed) a named subdirectory under Dir.

Types

type Config

type Config struct {
	// TLD is the top-level domain routed to the local proximo (without a dot).
	TLD string `json:"tld"`
}

Config holds the user-configurable settings persisted to disk.

func Default

func Default() Config

Default returns a Config populated with default values.

func Load

func Load() (Config, error)

Load reads the persisted config, returning defaults when none exists yet.

func (Config) Save

func (c Config) Save() error

Save persists the config to disk.

Jump to

Keyboard shortcuts

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