lxd: github.com/lxc/lxd/lxc/config Index | Files

package config

import "github.com/lxc/lxd/lxc/config"

Index

Package Files

cert.go config.go default.go errors.go file.go remote.go

Variables

var DefaultConfig = Config{
    Remotes:       DefaultRemotes,
    DefaultRemote: "local",
}

DefaultConfig is the default configuration

var DefaultRemotes = map[string]Remote{
    "images":       ImagesRemote,
    "local":        LocalRemote,
    "ubuntu":       UbuntuRemote,
    "ubuntu-daily": UbuntuDailyRemote,
}

DefaultRemotes is the list of default remotes

var ErrNotLinux = fmt.Errorf("Can't connect to a local LXD server on a non-Linux system")

ErrNotLinux is returned when attemping to access the "local" remote on non-Linux systems

var ImagesRemote = Remote{
    Addr:     "https://images.linuxcontainers.org",
    Public:   true,
    Protocol: "simplestreams",
}

ImagesRemote is the community image server (over simplestreams)

var LocalRemote = Remote{
    Addr:   "unix://",
    Static: true,
    Public: false,
}

LocalRemote is the default local remote (over the LXD unix socket)

var StaticRemotes = map[string]Remote{
    "local":        LocalRemote,
    "ubuntu":       UbuntuRemote,
    "ubuntu-daily": UbuntuDailyRemote,
}

StaticRemotes is the list of remotes which can't be removed

var UbuntuDailyRemote = Remote{
    Addr:     "https://cloud-images.ubuntu.com/daily",
    Static:   true,
    Public:   true,
    Protocol: "simplestreams",
}

UbuntuDailyRemote is the Ubuntu daily image server (over simplestreams)

var UbuntuRemote = Remote{
    Addr:     "https://cloud-images.ubuntu.com/releases",
    Static:   true,
    Public:   true,
    Protocol: "simplestreams",
}

UbuntuRemote is the Ubuntu image server (over simplestreams)

type Config Uses

type Config struct {
    // DefaultRemote holds the remote daemon name from the Remotes map
    // that the client should communicate with by default
    DefaultRemote string `yaml:"default-remote"`

    // Remotes defines a map of remote daemon names to the details for
    // communication with the named daemon
    Remotes map[string]Remote `yaml:"remotes"`

    // Command line aliases for `lxc`
    Aliases map[string]string `yaml:"aliases"`

    // Configuration directory
    ConfigDir string `yaml:"-"`

    // The UserAgent to pass for all queries
    UserAgent string `yaml:"-"`

    // PromptPassword is a helper function used when encountering an encrypted key
    PromptPassword func(filename string) (string, error) `yaml:"-"`

    // ProjectOverride allows overriding the default project for container queries
    ProjectOverride string `yaml:"-"`
    // contains filtered or unexported fields
}

Config holds settings to be used by a client or daemon

func LoadConfig Uses

func LoadConfig(path string) (*Config, error)

LoadConfig reads the configuration from the config path; if the path does not exist, it returns a default configuration.

func NewConfig Uses

func NewConfig(configDir string, defaults bool) *Config

NewConfig returns a Config, optionally using default remotes.

func (*Config) ConfigPath Uses

func (c *Config) ConfigPath(paths ...string) string

ConfigPath returns a joined path of the configuration directory and passed arguments

func (*Config) CookiesPath Uses

func (c *Config) CookiesPath(remote string) string

CookiesPath returns the path for the remote's cookie jar

func (*Config) GenerateClientCertificate Uses

func (c *Config) GenerateClientCertificate() error

GenerateClientCertificate will generate the needed client.crt and client.key if needed

func (*Config) GetImageServer Uses

func (c *Config) GetImageServer(name string) (lxd.ImageServer, error)

GetImageServer returns a ImageServer struct for the remote

func (*Config) GetInstanceServer Uses

func (c *Config) GetInstanceServer(name string) (lxd.InstanceServer, error)

GetInstanceServer returns a InstanceServer struct for the remote

func (*Config) HasClientCertificate Uses

func (c *Config) HasClientCertificate() bool

HasClientCertificate will return true if a client certificate has already been generated

func (*Config) ParseRemote Uses

func (c *Config) ParseRemote(raw string) (string, string, error)

ParseRemote splits remote and object

func (*Config) SaveConfig Uses

func (c *Config) SaveConfig(path string) error

SaveConfig writes the provided configuration to the config file.

func (*Config) SaveCookies Uses

func (c *Config) SaveCookies()

SaveCookies saves cookies to file

func (*Config) ServerCertPath Uses

func (c *Config) ServerCertPath(remote string) string

ServerCertPath returns the path for the remote's server certificate

type Remote Uses

type Remote struct {
    Addr     string `yaml:"addr"`
    AuthType string `yaml:"auth_type,omitempty"`
    Domain   string `yaml:"domain,omitempty"`
    Project  string `yaml:"project,omitempty"`
    Protocol string `yaml:"protocol,omitempty"`
    Public   bool   `yaml:"public"`
    Static   bool   `yaml:"-"`
}

Remote holds details for communication with a remote daemon

Package config imports 16 packages (graph) and is imported by 26 packages. Updated 2019-09-26. Refresh now. Tools for package owners.