Documentation
¶
Index ¶
- func DefaultLocalFile() string
- func DefaultPath() string
- func Exists(path string) bool
- func Render(v InitValues) string
- func ResolveSecret(ctx context.Context, s string) (string, error)
- func SuggestedAgentSocket() string
- func Write(path, content string) error
- type Caddy
- type Config
- type InitValues
- type Remote
- type Technitium
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLocalFile ¶
func DefaultLocalFile() string
DefaultLocalFile returns the default Caddyfile path: a "Caddyfile" sitting next to the config file (e.g. ~/.config/hl/Caddyfile), expressed with a leading ~ when it lives under the home directory so it reads cleanly and stays portable across machines.
func DefaultPath ¶
func DefaultPath() string
DefaultPath returns the config file path: $XDG_CONFIG_HOME/hl/config.yaml if XDG_CONFIG_HOME is set, otherwise ~/.config/hl/config.yaml on both macOS and Linux.
func Render ¶
func Render(v InitValues) string
Render produces a complete, grouped config file from v. Every string value is emitted quoted so user input containing YAML-significant characters (a colon, a leading #, *, [, {, ~, or an IPv6 host like [fd00::1]) round-trips intact.
func ResolveSecret ¶
ResolveSecret turns a configured secret value into its literal form:
- an "op://vault/item/field" reference is read via the 1Password CLI (`op read`)
- a value containing "${VAR}" is expanded from the environment
- any other value is returned unchanged
This lets the Technitium token be stored as a literal, an env reference, or a 1Password reference without a login step.
func SuggestedAgentSocket ¶
func SuggestedAgentSocket() string
SuggestedAgentSocket returns a stable ssh-agent socket to show as a hint during onboarding: the platform's 1Password agent socket. It is only a placeholder — leaving agent_socket empty makes hl fall back to $SSH_AUTH_SOCK at run time, which is the right default for the macOS built-in agent (whose socket lives under /var/run/com.apple.launchd.*/Listeners and rotates every login, so it must never be persisted).
Types ¶
type Config ¶
type Config struct {
Technitium Technitium `yaml:"technitium"`
Caddy Caddy `yaml:"caddy"`
// contains filtered or unexported fields
}
type InitValues ¶
type InitValues struct {
URL string
Token string
LocalFile string
RemoteHost string
RemoteUser string
RemotePort int
SSHKey string // set for key-file auth; empty otherwise
AgentSocket string // set for ssh-agent auth; empty falls back to $SSH_AUTH_SOCK
RemotePath string
ReloadCmd string
ValidateCmd string
ManagedTag string
}
InitValues holds the answers gathered by `hl config init` and rendered into a complete config file. All fields are present so the written file never omits a setting the user needs to fill.
func DefaultInitValues ¶
func DefaultInitValues() InitValues
DefaultInitValues returns the starting point for the init wizard / template.