config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMachineNotFound = errors.New("machine not found")

Functions

func ConfigDir

func ConfigDir(dir, configDirEnv string) (string, error)

func ReadConfigFile

func ReadConfigFile(filename string) ([]byte, error)

func WriteConfigFile

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

Types

type Config

type Config struct {
	Name        string            `toml:"name"`
	Image       string            `toml:"image"`
	Machine     Machine           `toml:"machine"`
	Public      PublicConfig      `toml:"public,omitempty"`
	Replicas    uint64            `toml:"replicas,omitempty"`
	Volumes     map[string]string `toml:"volumes,omitempty"`
	Env         map[string]string `toml:"env,omitempty"`
	Secrets     map[string]string `toml:"secrets,omitempty"`
	Label       map[string]string `toml:"label,omitempty"`
	Healthcheck HealthConfig      `toml:"healthcheck,omitempty"`
	Deploy      DeployConfig      `toml:"deploy,omitempty"`
}

func NewDefaultConfig

func NewDefaultConfig(name string) (Config, error)

func ParseConfig

func ParseConfig() (Config, error)

func (*Config) GetMachine

func (c *Config) GetMachine() (Machine, error)

func (Config) Save

func (c Config) Save() error

type DeployConfig

type DeployConfig struct {
	Order string `toml:"order,omitempty"`
}

type Duration

type Duration time.Duration

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(b []byte) error

type HealthConfig

type HealthConfig struct {
	Test          []string `toml:"test,omitempty"`
	Interval      Duration `toml:"interval,omitempty"`
	Timeout       Duration `toml:"timeout,omitempty"`
	StartInterval Duration `toml:"start_interval,omitempty"`
	StartPeriod   Duration `toml:"start_period,omitempty"`
	Retries       int      `toml:"retries,omitempty"`
}

type Machine

type Machine struct {
	IP           net.IP `toml:"ip"`
	Port         int    `toml:"port,omitempty"`
	User         string `toml:"user,omitempty"`
	IdentityFile string `toml:"identity_file,omitempty"`
	Passphrase   string `toml:"passphrase,omitempty"`
}

type PublicConfig

type PublicConfig struct {
	Address    string `toml:"address,omitempty"`
	TargetPort int    `toml:"target_port,omitempty"`
}

Jump to

Keyboard shortcuts

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