config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VIKING_CONFIG_DIR = "VIKING_CONFIG_DIR"
)

Variables

View Source
var (
	ErrKeyNameRequired = errors.New("key name is required")
	ErrKeyNotFound     = errors.New("key not found")
	ErrKeyExist        = errors.New("key already exists")
)
View Source
var (
	ErrMachineNotFound           = errors.New("machine not found")
	ErrMachineAlreadyExists      = errors.New("machine already exists")
	ErrMachineNameOrHostRequired = errors.New("machine name or host is required")
)

Functions

func ConfigDir

func ConfigDir() (string, error)

Types

type Config

type Config struct {
	Keys     map[string]Key
	Machines map[string]Machine
	Profile  Profile
}

func ParseDefaultConfig

func ParseDefaultConfig() (Config, error)

func (*Config) AddKey

func (c *Config) AddKey(key Key) error

func (*Config) AddMachine

func (c *Config) AddMachine(machine Machine) error

func (*Config) GetKeyByName

func (c *Config) GetKeyByName(name string) (Key, error)

func (*Config) GetMachineByName

func (c *Config) GetMachineByName(name string) (Machine, error)

func (*Config) ListKeys

func (c *Config) ListKeys() []Key

func (*Config) ListMachines

func (c *Config) ListMachines() []Machine

func (*Config) RemoveKey

func (c *Config) RemoveKey(name string) error

func (*Config) RemoveMachine

func (c *Config) RemoveMachine(machine string) error

RemoveMachine removes a machine from the config by name or host.

func (Config) Save

func (c Config) Save() error

type Host added in v0.2.0

type Host struct {
	IP   net.IP
	Port int
	User string
	Key  string
}

type Key

type Key struct {
	Name       string `toml:"-"`
	Private    string
	Public     string
	Passphrase string
	CreatedAt  time.Time
}

type Machine

type Machine struct {
	Name      string `toml:"-"`
	Hosts     []Host
	CreatedAt time.Time
}

type Profile added in v0.1.4

type Profile struct {
	Email string
}

Jump to

Keyboard shortcuts

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