Documentation ¶
Overview ¶
Package config manages project-independent configurations. Configurations describe the environment for the projects for a user, and system-wide stored in /etc/cneconfig
Index ¶
- Constants
- Variables
- func SetContextName(name string)
- type Config
- func (conf *Config) CreateContext(name string) (*Context, error)
- func (conf *Config) CreateRegistry(name string) (*Registry, error)
- func (conf *Config) CreateRuntime(name, engine string) (*Runtime, error)
- func (conf *Config) FullImageName(name string) (string, error)
- func (conf *Config) GetAllByName(name string) (string, interface{}, error)
- func (conf *Config) GetByName(name string) (string, string, error)
- func (conf *Config) GetContext() (*Context, string, error)
- func (conf *Config) GetEntryValue(entry string) (interface{}, error)
- func (conf *Config) GetRegistry(args ...string) (*Registry, error)
- func (conf *Config) GetRuntime(args ...string) (*Runtime, error)
- func (conf *Config) RemoveContext(name string) error
- func (conf *Config) RemoveRegistry(name string) error
- func (conf *Config) RemoveRuntime(name string) error
- func (conf *Config) RenameContext(from, to string) error
- func (conf *Config) RenameEntry(entry, from, to string) error
- func (conf *Config) RenameRegistry(from, to string) error
- func (conf *Config) RenameRuntime(from, to string) error
- func (conf *Config) SetByName(name string, value string) (string, string, error)
- func (conf *Config) Update(path string) error
- func (conf *Config) UpdateProjectConfig(path string) error
- func (conf *Config) User() (User, error)
- func (conf *Config) WriteProjectConfig(path string) error
- func (conf *Config) WriteSystemConfig() error
- func (conf *Config) WriteUserConfig() error
- type Context
- type Parameters
- type Registry
- type Runtime
- type Settings
- type User
Constants ¶
const ( UserConfigFile = ".cneconfig" SystemConfigFile = "/etc/cneconfig" ProjectConfigFile = "cneconfig" ConfigFilePerms = 0644 DefaultPackageVersion = "latest" DefaultContextName = "default" DefaultRuntimeName = "containerd" DefaultRuntimeEngine = "containerd" DefaultRuntimeSocketName = "/run/containerd/containerd.sock" DefaultRuntimeNamespace = "cne" DefaultRegistryName = "docker.io" DefaultRegistryDomain = "docker.io" DefaultRegistryRepoName = "library" )
const ( UpgradeNone = "" UpgradeImage = "image" UpgradeApt = "apt" )
Variables ¶
var CneVersion string
CneVersion is set in Makefile by a linker option to the git hash/version
Functions ¶
func SetContextName ¶
func SetContextName(name string)
Types ¶
type Config ¶
type Config struct { Settings Settings Context map[string]*Context Runtime map[string]*Runtime Registry map[string]*Registry }
func (*Config) CreateRuntime ¶
func (*Config) GetAllByName ¶
GetAllByName returns a 'reflect.Value' for the selected field, which can be a structure for nested structures.
func (*Config) GetByName ¶
Get returns the value of the configuration field specified by name Errors:
- ErrNotFound if the specified configuration field cannot be found
func (*Config) GetContext ¶
GetContext returns the context defined in the configuration files or from the --context flag when CNE was started.
func (*Config) GetEntryValue ¶
func (*Config) GetRegistry ¶
GetRegistry returns the specified registry or context-specific registry if name is empty
func (*Config) GetRuntime ¶
GetRuntime returns the specified runtime or context-specific runtime if name is empty
func (*Config) RemoveContext ¶
func (*Config) RemoveRegistry ¶
func (*Config) RemoveRuntime ¶
func (*Config) RenameContext ¶
func (*Config) RenameEntry ¶
func (*Config) RenameRegistry ¶
func (*Config) RenameRuntime ¶
func (*Config) Update ¶
Update updates the configuration with the values from the specified configuration file
func (*Config) UpdateProjectConfig ¶
UpdateProjectConfig updates the configuration from the config file in the project path
func (*Config) WriteProjectConfig ¶
WriteLocalConfig writes the configuration to the project directory
func (*Config) WriteSystemConfig ¶
WriteSystemConfig writes the system configuration to /etc/cneconfig.
func (*Config) WriteUserConfig ¶
WriteUserConfig writes the user configuration in the home directory of the current user.
type Context ¶
func (*Context) UpdateContextOptions ¶
type Parameters ¶
type Parameters struct {
Upgrade string // upgrade the listed components during container rebuilt
}
type User ¶
type User struct { Username string Groupname string Shell string IsSudo bool IsSuid bool UID uint32 EUID uint32 GID uint32 HomeDir string Pwd string BuildUID uint32 BuildGID uint32 }
func CurrentUser ¶
CurrentUser returns information about the current user. Note that for IsSudo, the CNE binary must run as root and SUDO_ envvars must be set.