Documentation ¶
Index ¶
- type Config
- type Option
- type Storage
- func (m *Storage) Default() (string, error)
- func (m *Storage) Delete(n string) error
- func (m *Storage) List() ([]string, error)
- func (m *Storage) Load(n string) (*Config, error)
- func (m *Storage) Rename(from, to string) error
- func (m *Storage) Set(n string, c *Config) error
- func (m *Storage) SetDefault(n string) error
- func (m *Storage) UnsetDefault() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Server is the configuration to talk to a Waypoint server. Server serverconfig.Client `hcl:"server,block"` // Workspace represents the current workspace for this context. This value // can be set instead of using the -workspace CLI flag. If empty, the // default value is "default" Workspace string `hcl:"workspace,optional"` }
Config is the structure of the context configuration file. This structure can be decoded with hclsimple.DecodeFile.
func (*Config) FromURL ¶ added in v0.5.0
FromURL parses a URL to a Waypoint server and populates as much of the context configuration as possible. This makes a number of assumptions:
- assumes TLS
- assumes TLS skip verify
The skip verify bit is a bad default but it is the most common UX getting started and this URL is most commonly used with `waypoint login` so we want to provide the smoothest experience there at the expense of a slight risk.
type Option ¶
func WithDir ¶
WithDir specifies the directory where context configuration will be stored. This doesn't have to exist already but we must have permission to create it.
func WithNoSymlink ¶ added in v0.1.3
func WithNoSymlink() Option
WithNoSymlink disables all symlink usage in the Storage. If symlinks were used previously then they'll still work.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the primary struct for interacting with stored CLI contexts. Contexts are always stored directly on disk with one set as the default.
func NewStorage ¶
NewStorage initializes context storage.
func TestStorage ¶
func TestStorage(t testing.T) *Storage
TestStorage returns a *Storage pointed at a temporary directory. This will cleanup automatically by using t.Cleanup.
func (*Storage) Rename ¶
Rename renames a context. This will error if the "from" context does not exist. If "from" is the default context then the default will be switched to "to". If "to" already exists, this will overwrite it.
func (*Storage) Set ¶
Set will set a new configuration with the given name. This will overwrite any existing context of this name.
func (*Storage) SetDefault ¶
SetDefault sets the default context to use. If the given context doesn't exist, an os.IsNotExist error will be returned.
func (*Storage) UnsetDefault ¶
UnsetDefault unsets the default context.