config

package
v0.0.0-...-a733983 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AppID = "com.github.amadigan.railyard"
View Source
const HomeEnv = "RAILYARD_HOME"
View Source
const Name = "railyard"
View Source
const SysHomeDir = "/usr/local/share/railyard"
View Source
const UserHomeDir = "${HOME}/Library/Application Support/railyard"
View Source
const Version = "0.1.0"

Variables

This section is empty.

Functions

func BuildHomePath

func BuildHomePath(env map[string]string, path string) (string, string)

func LoadConfig

func LoadConfig(env map[string]string, home string) (*Layout, *Path, error)

func ParseSize

func ParseSize(size string) (int64, error)

func WriteDefaultConfig

func WriteDefaultConfig(env map[string]string, home string, outpath *Path) error

Types

type DiskImage

type DiskImage struct {
	Mount         string   `json:"mount" yaml:"mount"`
	Size          string   `json:"size" yaml:"size"`
	Backup        bool     `json:"backup" yaml:"backup"`
	FS            string   `json:"fs" yaml:"fs"`
	FormatOptions []string `json:"mkfs" yaml:"mkfs"`
	ReadOnly      bool     `json:"ro,omitempty" yaml:"ro,omitempty"`
	Options       []string `json:"opts" yaml:"opts"`
	Path          *Path    `json:"path,omitempty" yaml:"path,omitempty"`
}

func (*DiskImage) UnmarshalJSON

func (d *DiskImage) UnmarshalJSON(data []byte) error

type DockerSocket

type DockerSocket struct {
	HostPath      Paths  `json:"host"`
	ContainerPath string `json:"container"`
}

func (DockerSocket) MarshalJSON

func (d DockerSocket) MarshalJSON() ([]byte, error)

func (*DockerSocket) UnmarshalJSON

func (d *DockerSocket) UnmarshalJSON(data []byte) error

type Layout

type Layout struct {
	Home           string                `json:"-" yaml:"-"`
	Ram            uint64                `json:"ram,omitempty" yaml:"ram,omitempty"`
	Cpu            uint                  `json:"cpu,omitempty" yaml:"cpu,omitempty"`
	Kernel         *Path                 `json:"kernel,omitempty" yaml:"kernel,omitempty"`
	Root           *Path                 `json:"root,omitempty" yaml:"root,omitempty"`
	Disks          map[string]*DiskImage `json:"disks" yaml:"disks"`
	Shares         map[string]*Share     `json:"shares" yaml:"shares"`
	DockerSocket   DockerSocket          `json:"docker-socket" yaml:"docker-socket"`
	Sockets        map[string]string     `json:"sockets" yaml:"sockets"`
	Console        bool                  `json:"-" yaml:"-"`
	JsonConfigs    map[string]any        `json:"json-conf" yaml:"json-conf"`
	HostIface      string                `json:"host-iface,omitempty" yaml:"host-iface,omitempty"`
	Sysctl         map[string]string     `json:"sysctl" yaml:"sysctl"`
	StateFile      *Path                 `json:"state-file,omitempty" yaml:"state-file,omitempty"`
	Log            LogConfig             `json:"logs" yaml:"logs"`
	DockerConfig   map[string]any        `json:"dockerd" yaml:"dockerd"`
	MetricInterval uint16                `json:"metric-interval,omitempty" yaml:"metric-interval,omitempty"`
	Rosetta        *bool                 `json:"rosetta,omitempty" yaml:"rosetta,omitempty"`
	IdleTimeout    time.Duration         `json:"idle-timeout,omitempty" yaml:"idle-timeout,omitempty"`
}

func (*Layout) ResolvePaths

func (l *Layout) ResolvePaths(env map[string]string) error

func (*Layout) SetDefaultSockets

func (l *Layout) SetDefaultSockets()

func (*Layout) SetDefaults

func (l *Layout) SetDefaults()

func (*Layout) UnmarshalJSON

func (l *Layout) UnmarshalJSON(data []byte) error

type LogConfig

type LogConfig struct {
	Level     string            `json:"level,omitempty"`
	Directory *Path             `json:"dir,omitempty"`
	Streams   map[string]string `json:"streams,omitempty"`
}

func (LogConfig) MarshalJSON

func (l LogConfig) MarshalJSON() ([]byte, error)

func (*LogConfig) UnmarshalJSON

func (l *LogConfig) UnmarshalJSON(data []byte) error

type Path

type Path struct {
	Original string
	Resolved string
}

func (*Path) MarshalText

func (p *Path) MarshalText() ([]byte, error)

func (*Path) ResolveInputDir

func (p *Path) ResolveInputDir(env map[string]string, root string) bool

func (*Path) ResolveInputFile

func (p *Path) ResolveInputFile(env map[string]string, root string) bool

func (Path) ResolveListenSocket

func (p Path) ResolveListenSocket(env map[string]string, root string) (network string, addr string, err error)

func (*Path) ResolveOutputDir

func (p *Path) ResolveOutputDir(env map[string]string, root string) error

func (*Path) ResolveOutputFile

func (p *Path) ResolveOutputFile(env map[string]string, root string) (bool, error)

func (*Path) UnmarshalText

func (p *Path) UnmarshalText(data []byte) error

type Paths

type Paths []*Path

func (Paths) MarshalJSON

func (p Paths) MarshalJSON() ([]byte, error)

func (*Paths) UnmarshalJSON

func (p *Paths) UnmarshalJSON(data []byte) error

type Share

type Share struct {
	Source   *Path
	ReadOnly bool
}

func (*Share) UnmarshalText

func (s *Share) UnmarshalText(data []byte) error

type UnknownFieldError

type UnknownFieldError struct {
	Field string
	Type  string
}

func (*UnknownFieldError) Error

func (e *UnknownFieldError) Error() string

type UnmatchedVariableError

type UnmatchedVariableError struct {
	Variables []string
}

func (*UnmatchedVariableError) Error

func (e *UnmatchedVariableError) Error() string

Jump to

Keyboard shortcuts

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