config

package
v1.8.14 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath(homeDir string, wd string) string

GetConfigPath identifies the location of edward.json, if any exists

func GetConfigPathFromWorkingDirectory

func GetConfigPathFromWorkingDirectory(homeDir string) (string, error)

Types

type Config

type Config struct {
	MinEdwardVersion string                   `json:"edwardVersion,omitempty"`
	Imports          []string                 `json:"imports,omitempty"`
	ImportedGroups   []GroupDef               `json:"-"`
	ImportedServices []services.ServiceConfig `json:"-"`
	Env              []string                 `json:"env,omitempty"`
	Groups           []GroupDef               `json:"groups,omitempty"`
	Services         []services.ServiceConfig `json:"services"`

	ServiceMap map[string]*services.ServiceConfig      `json:"-"`
	GroupMap   map[string]*services.ServiceGroupConfig `json:"-"`

	FilePath string `json:"-"`
	// contains filtered or unexported fields
}

Config defines the structure for the Edward project configuration file

func EmptyConfig

func EmptyConfig(workingDir string) Config

EmptyConfig creates a Config with no services or groups

func LoadConfig

func LoadConfig(filePath string, edwardVersion string) (Config, error)

LoadConfig loads configuration from an io.Reader with the working directory explicitly specified

func NewConfig

func NewConfig(newServices []services.ServiceConfig, newGroups []services.ServiceGroupConfig) Config

NewConfig creates a Config from slices of services and groups

func (*Config) AddGroups

func (c *Config) AddGroups(groups []services.ServiceGroupConfig) error

AddGroups adds a slice of groups to the Config

func (*Config) AppendGroups

func (c *Config) AppendGroups(groups []*services.ServiceGroupConfig) error

AppendGroups adds groups to an existing config without replacing existing groups

func (*Config) AppendServices

func (c *Config) AppendServices(newServices []*services.ServiceConfig) error

AppendServices adds services to an existing config without replacing existing services

func (*Config) NormalizeServicePaths

func (c *Config) NormalizeServicePaths(searchPath string, newServices []*services.ServiceConfig) ([]*services.ServiceConfig, error)

NormalizeServicePaths will modify the Paths for each of the provided services to be relative to the working directory of this config file

func (*Config) RemoveGroup

func (c *Config) RemoveGroup(name string) error

func (Config) Save

func (c Config) Save(writer io.Writer) error

Save saves config to an io.Writer

type GroupDef

type GroupDef struct {
	Name        string   `json:"name"`
	Aliases     []string `json:"aliases,omitempty"`
	Description string   `json:"description,omitempty"`
	Children    []string `json:"children"`
	Env         []string `json:"env,omitempty"`
}

GroupDef defines a group based on a list of children specified by name

Jump to

Keyboard shortcuts

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