config

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfig

func WriteConfig(path string, config *Config) error

WriteConfig writes configuration to given path

func WriteProjectConfig added in v0.2.4

func WriteProjectConfig(path string, config *ProjectConfig) error

WriteProjectConfig writes project config in yaml format into given path

Types

type Config

type Config struct {
	Endpoints []Endpoint `yaml:"endpoints"`
	Namespace string     `yaml:"namespace"`
}

Config is struct for configuration for CLI client

func GetConfig

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

GetConfig reads current config from user home directory

func (*Config) Set

func (c *Config) Set(field, value string)

Set mutates the Config by updating single field with value

type Endpoint

type Endpoint struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
}

Endpoint represents Can server

func (Endpoint) GetHost

func (e Endpoint) GetHost() string

GetHost return just hostname/ip of endpoint URL

type ProjectConfig

type ProjectConfig struct {
	Name    string   `yaml:"name,omitempty"`
	Image   string   `yaml:"image,omitempty"`
	Command []string `yaml:"command,omitempty"`
	Env     []string `yaml:"env,omitempty"`
	Binds   []string `yaml:"binds,omitempty"`
	Mounts  []string `yaml:"mounts,omitempty"`
	WorkDir string   `yaml:"workdir,omitempty"`

	SyncContainer *containers.Container `yaml:"syncContainer,omitempty"`
	Syncs         []string              `yaml:"syncs,omitempty"`
	// contains filtered or unexported fields
}

ProjectConfig represents configuration in project directory

func ReadProjectConfig

func ReadProjectConfig(path string) *ProjectConfig

ReadProjectConfig read ProjectConfig from given path If file doesn't exist, returns empty config so it's safe for reading even The file doesn't exist. In any other failure case, will fatal.

func (ProjectConfig) EnvWith

func (p ProjectConfig) EnvWith(values []string) (result []string)

EnvWith return list of environment variable definitions from project configs with values appended to end of the list.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider works as Facade for underlying config with capability to override some values

func NewProvider

func NewProvider(config *Config) *Provider

NewProvider creates new Provider around config instance

func (*Provider) GetEndpointByName

func (c *Provider) GetEndpointByName(name string) (endpoint Endpoint, ok bool)

GetEndpointByName finds Endpoint by name or return ok=false

func (*Provider) GetEndpoints

func (c *Provider) GetEndpoints() []Endpoint

GetEndpoints return current namespace

func (*Provider) GetNamespace

func (c *Provider) GetNamespace() string

GetNamespace return current namespace

func (*Provider) OverrideEndpoints

func (c *Provider) OverrideEndpoints(endpoints []Endpoint)

OverrideEndpoints set endpoint to be overrided with given value

func (*Provider) OverrideNamespace

func (c *Provider) OverrideNamespace(namespace string)

OverrideNamespace set namespace to be overrided with given value

Jump to

Keyboard shortcuts

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