config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config holds the deploy configuration and persists it (0600) under ~/.config/pocketdev/config.json so re-runs remember your choices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HCloudCLIToken

func HCloudCLIToken() (token, contextName string, ok bool)

HCloudCLIToken reads the active context's token from the official hcloud CLI config (~/.config/hcloud/cli.toml). Best-effort: returns ok=false on any miss, so users who already ran `hcloud context create` skip the token step.

func Path

func Path() (string, error)

Path is the on-disk config location.

func Save

func Save(c Config) error

Save persists the config with 0600 perms.

Types

type Config

type Config struct {
	Agents        []string `json:"agents"`
	Name          string   `json:"name"`
	Region        string   `json:"region"`
	ServerType    string   `json:"server_type"`
	WithoutIPv4   bool     `json:"without_ipv4"`
	RebootTime    string   `json:"reboot_time"`
	TSTag         string   `json:"ts_tag"`
	SSHPublicKeys []string `json:"ssh_public_keys"`

	Source    string `json:"source"`     // "github" | "rsync" | "fresh"
	GitHub    bool   `json:"github"`     // set up gh + clone on the box (source=github)
	RepoURL   string `json:"repo_url"`   // repo to clone (owner/repo or URL)
	LocalPath string `json:"local_path"` // local folder/file to rsync (source=rsync)

	SSHIDHandle string `json:"sshid_handle"` // Termius SSH ID handle; its public keys are added to the box for keyless mobile

	UseExisting    bool   `json:"use_existing"`    // adopt a server you already own instead of creating
	ExistingServer string `json:"existing_server"` // Hetzner server name chosen to adopt
	SSHHost        string `json:"ssh_host"`        // IPv4 or tailnet/MagicDNS name to reach an adopted box
	SSHUser        string `json:"ssh_user"`        // login user for adoption; default "root"
	Category       string `json:"category"`        // selected size category (create path)

	HCloudToken   string `json:"hcloud_token"`
	TSOAuthID     string `json:"ts_oauth_client_id"`
	TSOAuthSecret string `json:"ts_oauth_client_secret"`
	TSAuthKey     string `json:"ts_authkey"`
}

Config is everything needed to provision a box. Secrets are stored too, so the file is written with 0600 perms.

func Defaults

func Defaults() Config

Defaults returns a config pre-filled with sensible values and any matching environment variables (env wins over the blank defaults).

func Load

func Load() (Config, error)

Load reads the saved config, falling back to Defaults() if none exists. Saved values are overlaid on defaults; env vars still win for secrets.

Jump to

Keyboard shortcuts

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