config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 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

Overview

Package config holds hopsesh's user configuration and state locations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() string

Dir is the configuration directory: $XDG_CONFIG_HOME/hopsesh or ~/.config/hopsesh on macOS and Linux, %APPDATA%\hopsesh on Windows.

func Path

func Path() string

Path is the configuration file.

func Save

func Save(c Config) error

Save writes the configuration atomically with user-only permissions.

func StateDir

func StateDir() string

StateDir holds the audit log, undo journal, staging area and hopsesh's own known_hosts: $XDG_STATE_HOME/hopsesh or ~/.local/state/hopsesh; %LOCALAPPDATA%\hopsesh on Windows.

Types

type Config

type Config struct {
	ReposDir   string `toml:"repos_dir"`   // where clones go; default ~/git
	Layout     string `toml:"layout"`      // flat | ghq
	LivePolicy string `toml:"live_policy"` // handoff | fork
	RemoteCtl  bool   `toml:"remote_control"`
	// UpdateCheck is "on" or "off" once the person has answered whether the app may
	// look for new releases once a day ("" = not asked yet).
	UpdateCheck string `toml:"update_check,omitempty"`
	Hosts       []Host `toml:"hosts"`
}

Config is the user's configuration file.

func Defaults

func Defaults() Config

Defaults returns the configuration used when no file exists.

func Load

func Load() (Config, error)

Load reads the configuration, filling defaults for missing values.

func (*Config) FindHost

func (c *Config) FindHost(name string) *Host

FindHost returns the configured host with this name.

func (*Config) UpsertHost

func (c *Config) UpsertHost(h Host)

UpsertHost adds or updates a host by name, keeping consent unless explicitly changed.

type Host

type Host struct {
	Name        string `toml:"name"`        // label shown to the user, e.g. "studio"
	Destination string `toml:"destination"` // what to pass to ssh: alias, user@host or host
	Via         string `toml:"via"`         // tailscale | ssh-config | manual (or a "+" combination)
	Allowed     bool   `toml:"allowed"`     // the user consented to hopsesh connecting
	OS          string `toml:"os,omitempty"`
	// TailscaleName is the machine's MagicDNS name, used when Destination's own host
	// name does not resolve (e.g. an alias pointing at a .local name on another network).
	TailscaleName string `toml:"tailscale_name,omitempty"`
	Helper        bool   `toml:"helper,omitempty"` // the user allowed deploying the remote helper
	// HelperSHA256 pins the helper binary hopsesh uploaded; a helper that no longer
	// matches is not run.
	HelperSHA256 string `toml:"helper_sha256,omitempty"`
}

Host is one machine hopsesh knows about.

Jump to

Keyboard shortcuts

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