config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

func ConfigFile

func ConfigFile() (string, error)

func DefaultConfigRoot

func DefaultConfigRoot() *yaml.Node

func WriteConfigFile

func WriteConfigFile(filename string, data []byte) error

Types

type Config

type Config interface {
	Write() error
	Machines() *MachinesConfig
	Keys() *KeysConfig
	Email() string
	SetEmail(email string) error
}

func NewConfig

func NewConfig(documentNode *yaml.Node) Config

func ParseDefaultConfig

func ParseDefaultConfig() (Config, error)

type KeyEntry

type KeyEntry struct {
	Name       string
	Private    string
	Public     string
	Passphrase string
	CreatedAt  time.Time
}

type KeysConfig

type KeysConfig struct {
	Node   *yaml.Node
	Parent Config
}

func (*KeysConfig) Add

func (c *KeysConfig) Add(entry KeyEntry) error

func (*KeysConfig) All

func (c *KeysConfig) All() []KeyEntry

func (*KeysConfig) GetByName

func (c *KeysConfig) GetByName(name string) (KeyEntry, error)

func (*KeysConfig) Remove

func (c *KeysConfig) Remove(name string) error

type MachineEntry

type MachineEntry struct {
	Name      string
	Host      net.IP
	User      string
	Key       string
	CreatedAt time.Time
}

type MachinesConfig

type MachinesConfig struct {
	Node   *yaml.Node
	Parent Config
}

func (*MachinesConfig) Add

func (c *MachinesConfig) Add(entry MachineEntry) error

func (*MachinesConfig) All

func (c *MachinesConfig) All() []MachineEntry

func (*MachinesConfig) GetByNameOrHost

func (c *MachinesConfig) GetByNameOrHost(nameOrHost string) *MachineEntry

func (*MachinesConfig) Remove

func (c *MachinesConfig) Remove(nameOrHost string) error

Jump to

Keyboard shortcuts

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