Documentation
¶
Overview ¶
Package config defines the persistent on-disk model for kay: the set of keys, users (login users live on the server record) and servers the operator has registered. State is a single human-inspectable JSON file; private keys are never stored in it (only paths to PEM files on disk).
Index ¶
- Constants
- type Key
- type KeyType
- type PanelPref
- type Server
- type Store
- func (s *Store) AddKey(k Key) error
- func (s *Store) AddServer(srv Server) error
- func (s *Store) Dir() string
- func (s *Store) FindKey(name string) (*Key, error)
- func (s *Store) FindServer(alias string) (*Server, error)
- func (s *Store) KeysDir() string
- func (s *Store) KnownHostsPath() string
- func (s *Store) OverviewPanels() []PanelPref
- func (s *Store) RemoveServer(alias string) error
- func (s *Store) Save() error
- func (s *Store) SetOverviewPanels(panels []PanelPref)
- type UISettings
Constants ¶
const CurrentVersion = 1
CurrentVersion is the schema version stamped on save. Version 0 (absent) is the original v0.1 layout, which had no version field; it is read without migration.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key struct {
Name string `json:"name"`
Type KeyType `json:"type"`
PrivatePath string `json:"privatePath"`
PublicPath string `json:"publicPath"`
Fingerprint string `json:"fingerprint"`
CreatedAt time.Time `json:"createdAt"`
}
Key is a locally generated key pair, referenced by servers via Name.
type PanelPref ¶ added in v0.2.0
PanelPref is one Overview panel's saved preference: its identifier plus whether the user hid it. Order in the slice is the display order.
type Server ¶
type Server struct {
Alias string `json:"alias"`
Host string `json:"host"`
Port int `json:"port"`
User string `json:"user"`
KeyName string `json:"keyName"`
}
Server is a registered remote host plus the login user and key to use.
type Store ¶
type Store struct {
Version int `json:"version"`
Keys []Key `json:"keys"`
Servers []Server `json:"servers"`
UI *UISettings `json:"ui,omitempty"`
// contains filtered or unexported fields
}
Store is the whole persisted state.
func Load ¶
Load reads the store from disk, creating directories as needed. A missing config file is not an error: it yields an empty, ready-to-use store.
func (*Store) AddServer ¶
AddServer appends a server, rejecting duplicate aliases and verifying the referenced key exists.
func (*Store) FindServer ¶
FindServer returns the server with the given alias, or an error.
func (*Store) KnownHostsPath ¶
KnownHostsPath returns the path to the TOFU known_hosts file.
func (*Store) OverviewPanels ¶ added in v0.2.0
OverviewPanels returns the saved Overview panel layout, or nil when the user has not customised it (callers then fall back to their built-in default order).
func (*Store) RemoveServer ¶
RemoveServer deletes a server by alias.
func (*Store) Save ¶
Save atomically writes the store to disk with restrictive permissions. It stamps the current schema version; older files (version 0) are upgraded in place on the next save without touching existing keys or servers.
func (*Store) SetOverviewPanels ¶ added in v0.2.0
SetOverviewPanels records a customised Overview layout.
type UISettings ¶ added in v0.2.0
type UISettings struct {
Overview []PanelPref `json:"overview,omitempty"` // Overview panel order + visibility
}
UISettings holds user interface preferences that persist across sessions.