config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: MIT Imports: 9 Imported by: 12

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

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"`
	Image string     `yaml:"image"`
	Env   []string   `yaml:"env"`
	Binds []string   `yaml:"binds"`
	Sync  SyncConfig `yaml:"sync"`
	// contains filtered or unexported fields
}

ProjectConfig represents configuration in project directory

func ReadProjectConfig

func ReadProjectConfig(path string) (result *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

type SyncConfig

type SyncConfig struct {
	Image  string `yaml:"image"`
	Target string `yaml:"target"`
}

SyncConfig represents sync related configurations

Jump to

Keyboard shortcuts

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