configuration

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ChangeChannel is the channel that is used to notify the application that the configuration has changed.
	ChangeChannel = make(chan bool)
)

Functions

func IsConfigurationLoaded

func IsConfigurationLoaded() bool

IsConfigurationLoaded returns true if the configuration is loaded.

func LoadConfiguration

func LoadConfiguration(options *Options) error

LoadConfiguration loads the configuration from the given options.

Types

type Configuration

type Configuration struct {
	// BaseImage is a reference to the BaseImage configuration.
	BaseImage *bi.Configuration `json:"base_image" yaml:"base_image" toml:"base_image" mapstructure:"base_image"`
	// CloudInit is a reference to the CloudInit configuration.
	CloudInit *ci.Configuration `json:"cloud_init" yaml:"cloud_init" toml:"cloud_init" mapstructure:"cloud_init"`
	// Downloader is a reference to the Downloader configuration.
	Downloader *downloader.Configuration `json:"downloader" yaml:"downloader" toml:"downloader" mapstructure:"downloader"`
	// Qemu is a reference to the Qemu configuration.
	Qemu *qemu.Configuration `json:"qemu" yaml:"qemu" toml:"qemu" mapstructure:"qemu"`
	// Repositories is a list of repositories that will be added to the base image.
	Repositories []*repositories.Configuration `json:"repositories" yaml:"repositories" toml:"repositories" mapstructure:"repositories"`
	// UnattendedUpgrades is a reference to the UnattendedUpgrades configuration.
	UnattendedUpgrades *uu.Configuration `json:"unattended_upgrades" yaml:"unattended_upgrades" toml:"unattended_upgrades" mapstructure:"unattended_upgrades"`
	// BasePackages is a list of packages that will be installed in the base image.
	BasePackages []string `json:"base_packages" yaml:"base_packages" toml:"base_packages" mapstructure:"base_packages"`
	// ExtraPackages is a list of user specified packages that will be installed in the base image.
	ExtraPackages []string `json:"extra_packages" yaml:"extra_packages" toml:"extra_packages" mapstructure:"extra_packages"`
	// LogLevel is the log level for the application.
	LogLevel string `json:"log_level" yaml:"log_level" toml:"log_level" mapstructure:"log_level"`
}

Configuration is the configuration for the application.

func GetConfiguration

func GetConfiguration() *Configuration

GetConfiguration returns the configuration for the application.

func (*Configuration) GetBaseImage

func (configuration *Configuration) GetBaseImage() *bi.Configuration

GetBaseImage returns the BaseImage configuration.

func (*Configuration) GetBasePackages

func (configuration *Configuration) GetBasePackages() []string

GetBasePackages returns the list of packages that will be installed in the base image.

func (*Configuration) GetCloudInit

func (configuration *Configuration) GetCloudInit() *ci.Configuration

GetCloudInit returns the CloudInit configuration.

func (*Configuration) GetDownloader

func (configuration *Configuration) GetDownloader() *downloader.Configuration

GetDownloader returns the Downloader configuration.

func (*Configuration) GetExtraPackages

func (configuration *Configuration) GetExtraPackages() []string

GetExtraPackages returns the list of user specified packages that will be installed in the base image.

func (*Configuration) GetLogLevel

func (configuration *Configuration) GetLogLevel() string

GetLogLevel returns the log level for the application.

func (*Configuration) GetQemu

func (configuration *Configuration) GetQemu() *qemu.Configuration

GetQemu returns the Qemu configuration.

func (*Configuration) GetRepositories

func (configuration *Configuration) GetRepositories() []*repositories.Configuration

GetRepositories returns the list of repositories that will be added to the base image.

func (*Configuration) GetUnattendedUpgrades

func (configuration *Configuration) GetUnattendedUpgrades() *uu.Configuration

GetUnattendedUpgrades returns the UnattendedUpgrades configuration.

type Options

type Options struct {
	// Name is the name of the configuration file.
	Name string
	// Path is the path to the configuration file.
	Path string
	// Extension is the extension of the configuration file.
	Extension string
}

Options is a struct that holds the configuration options for the application.

func NewCustomOptions

func NewCustomOptions(name, path, extension string) *Options

NewCustomOptions creates a new Options struct with custom values.

func NewDefaultOptions

func NewDefaultOptions() *Options

NewDefaultOptions creates a new Options struct with default values.

func NewOptions

func NewOptions(name, path, extension string) Options

NewOptions creates a new Options struct.

func (*Options) GetExtension

func (options *Options) GetExtension() string

GetExtension returns the extension of the configuration file.

func (*Options) GetName

func (options *Options) GetName() string

GetName returns the name of the configuration file.

func (*Options) GetPath

func (options *Options) GetPath() string

GetPath returns the path to the configuration file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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