Documentation
¶
Overview ¶
Package config manages jugctl's on-disk TOML configuration store of saved git servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Servers []Server `toml:"servers"`
}
Config is the top-level TOML document: a list of saved servers.
func Load ¶
Load reads the config file from its default XDG-resolved path, returning an empty Config if the file does not exist yet.
func LoadFrom ¶
LoadFrom reads and decodes the config file at path, returning an empty Config if the file does not exist.
func (*Config) Get ¶
Get looks up a server by its friendly name, returning an error if no such server is saved.
func (*Config) List ¶
List returns all saved servers sorted by name.
func (*Config) Save ¶
Save writes cfg to the default XDG-resolved config path, creating the containing directory if needed.
func (*Config) SaveTo ¶
SaveTo writes cfg to path atomically: it writes to a temp file in the same directory and renames it into place, so a crash or concurrent read never observes a partially written file.
type Server ¶
type Server struct {
// Name is the friendly key used to refer to this server on the
// command line.
Name string `toml:"name"`
// GitHost is the hostname clients use in git@<host>:repo.git clone
// URLs, and the git vhost's own hostname for HTTP clone and
// go-import discovery.
GitHost string `toml:"git_host"`
// WebHost is the hostname Caddy serves the cgit browsing UI on.
WebHost string `toml:"web_host"`
// ServiceUser is the unprivileged account that owns the rootless
// podman pod on the remote host. jugctl connects as this user to
// deploy: writing quadlet units and (re)starting the pod.
ServiceUser string `toml:"service_user"`
// ServicePort is the SSH port the service user's sshd listens on
// (the host's admin sshd, not the container's).
ServicePort int `toml:"service_port"`
// ServiceIdentityFile is the path to the SSH private key used to
// authenticate as ServiceUser.
ServiceIdentityFile string `toml:"service_identity_file"`
// GitUser is the account the container's sshd exposes for
// git-shell operations (typically "git").
GitUser string `toml:"git_user"`
// GitPort is the SSH port the container's sshd listens on
// (published by the pod, typically 22).
GitPort int `toml:"git_port"`
// GitIdentityFile is the path to the SSH private key used to
// authenticate as GitUser.
GitIdentityFile string `toml:"git_identity_file"`
// ACMEEmail is the contact email Caddy registers with Let's
// Encrypt for automatic HTTPS.
ACMEEmail string `toml:"acme_email"`
// CgitTitle is cgit's root-title.
CgitTitle string `toml:"cgit_title"`
// CgitDescription is cgit's root-desc.
CgitDescription string `toml:"cgit_description"`
// DefaultBranch sets the git user's global init.defaultBranch,
// applied to repos created by "jugctl repo create".
DefaultBranch string `toml:"default_branch"`
// AuthorizedKeys lists the public keys (in authorized_keys line
// format) allowed to authenticate as GitUser.
AuthorizedKeys []string `toml:"authorized_keys"`
// Image is the just-use-git container image reference to deploy.
// There's no registry default: it's set by "jugctl build" (which
// auto-persists the tag it just built) or an explicit --image
// override.
Image string `toml:"image,omitempty"`
}
Server holds everything jugctl needs to deploy and manage a containerized just-use-git server.
Source Files
¶
- accessors.go
- config.go
- path.go
- types.go