config

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultWebUIListenAddress = ":8080"
	FilePrefix                = "file://"
)
View Source
const DefaultHeader = "#cloud-config"

Variables

View Source
var MergeBootLine = func(o *Options) error {
	o.MergeBootCMDLine = true
	return nil
}

Functions

func AddHeader

func AddHeader(header, data string) string

func FindYAMLWithKey added in v1.3.0

func FindYAMLWithKey(s string, opts ...Option) ([]string, error)

func FromString

func FromString(s string, o interface{}) error

func HasHeader

func HasHeader(userdata, head string) (bool, string)

func MergeYAML

func MergeYAML(objs ...interface{}) ([]byte, error)

func SaveCloudConfig

func SaveCloudConfig(name Stage, yc yip.YipConfig) error

Types

type Bundle

type Bundle struct {
	Repository string   `yaml:"repository,omitempty"`
	Rootfs     string   `yaml:"rootfs_path,omitempty"`
	DB         string   `yaml:"db_path,omitempty"`
	LocalFile  bool     `yaml:"local_file,omitempty"`
	Targets    []string `yaml:"targets,omitempty"`
}

type Bundles

type Bundles []Bundle

func (Bundles) Options

func (b Bundles) Options() (res [][]bundles.BundleOption)

type Config

type Config struct {
	Install *Install `yaml:"install,omitempty"`

	ConfigURL          string            `yaml:"config_url,omitempty"`
	Options            map[string]string `yaml:"options,omitempty"`
	FailOnBundleErrors bool              `yaml:"fail_on_bundles_errors,omitempty"`
	Bundles            Bundles           `yaml:"bundles,omitempty"`
	GrubOptions        map[string]string `yaml:"grub_options,omitempty"`
	Env                []string          `yaml:"env,omitempty"`
	// contains filtered or unexported fields
}

func Scan

func Scan(opts ...Option) (c *Config, err error)

func (Config) Data

func (c Config) Data() map[string]interface{}

func (Config) HasConfigURL added in v1.6.0

func (c Config) HasConfigURL() bool

HasConfigURL returns true if ConfigURL has been set and false if it's empty.

func (Config) Query added in v1.4.0

func (c Config) Query(s string) (res string, err error)

func (Config) String

func (c Config) String() string

func (Config) Unmarshal

func (c Config) Unmarshal(o interface{}) error

type Install

type Install struct {
	Auto                   bool              `yaml:"auto,omitempty"`
	Reboot                 bool              `yaml:"reboot,omitempty"`
	Device                 string            `yaml:"device,omitempty"`
	Poweroff               bool              `yaml:"poweroff,omitempty"`
	GrubOptions            map[string]string `yaml:"grub_options,omitempty"`
	Bundles                Bundles           `yaml:"bundles,omitempty"`
	Encrypt                []string          `yaml:"encrypted_partitions,omitempty"`
	SkipEncryptCopyPlugins bool              `yaml:"skip_copy_kcrypt_plugin,omitempty"`
	Env                    []string          `yaml:"env,omitempty"`
	Image                  string            `yaml:"image,omitempty"`
	EphemeralMounts        []string          `yaml:"ephemeral_mounts,omitempty"`
	BindMounts             []string          `yaml:"bind_mounts,omitempty"`
}

type Option

type Option func(o *Options) error
var NoLogs Option = func(o *Options) error {
	o.NoLogs = true
	return nil
}

func Directories

func Directories(d ...string) Option

func StrictValidation added in v1.6.0

func StrictValidation(b bool) Option

StrictValidation sets the strict validation option to true or false.

func WithBootCMDLineFile

func WithBootCMDLineFile(s string) Option

type Options

type Options struct {
	ScanDir          []string
	BootCMDLineFile  string
	MergeBootCMDLine bool
	NoLogs           bool
	StrictValidation bool
}

func (*Options) Apply

func (o *Options) Apply(opts ...Option) error

type Stage

type Stage string
const (
	NetworkStage Stage = "network"
)

func (Stage) String

func (n Stage) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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