config

package
v0.0.0-...-521d647 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath(wd string) string

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

func GetConfigPathFromWorkingDirectory

func GetConfigPathFromWorkingDirectory() (string, error)

Types

type Config

type Config struct {
	MinNedwardVersion string                   `json:"nedwardVersion,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 Nedward 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, nedwardVersion 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