config

package
v0.0.0-...-48281b1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllGroupNames

func GetAllGroupNames() []string

GetAllGroupNames returns a slice of the names of all groups

func GetAllGroupsSorted

func GetAllGroupsSorted() []services.ServiceOrGroup

GetAllGroupsSorted returns a slice of all groups, sorted by name

func GetAllServiceNames

func GetAllServiceNames() []string

GetAllServiceNames returns a slice of the names of all services

func GetAllServicesSorted

func GetAllServicesSorted() []services.ServiceOrGroup

GetAllServicesSorted returns a slice of all services, sorted by name

func GetBasePath

func GetBasePath() string

GetBasePath returns the base directory for the current shared config

func GetServiceMap

func GetServiceMap() map[string]*services.ServiceConfig

GetServiceMap returns the shared map of Services

func GetServiceOrGroup

func GetServiceOrGroup(name string) (services.ServiceOrGroup, error)

GetServiceOrGroup returns the service/group matching the provided name

func GetServicesOrGroups

func GetServicesOrGroups(names []string) ([]services.ServiceOrGroup, error)

GetServicesOrGroups returns services and groups matching any of the provided names

func InitEmptyConfig

func InitEmptyConfig()

InitEmptyConfig initializes the shared maps in an empty state

func LoadSharedConfig

func LoadSharedConfig(configPath string, edwardVersion string, logger common.Logger) error

LoadSharedConfig loads an Edward project config into the shared maps

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:"-"`

	Logger   common.Logger `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, logger common.Logger) Config

EmptyConfig creates a Config with no services or groups

func LoadConfig

func LoadConfig(filePath string, edwardVersion string, logger common.Logger) (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, logger common.Logger) 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