config

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProgramGroup *ProcessGroup
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(configFile string) *Config

func (*Config) GetConfigFileDir

func (c *Config) GetConfigFileDir() string

func (*Config) GetEntries

func (c *Config) GetEntries(filterFunc func(entry *ConfigEntry) bool) []*ConfigEntry

func (*Config) GetEventListeners

func (c *Config) GetEventListeners() []*ConfigEntry

func (*Config) GetGroups

func (c *Config) GetGroups() []*ConfigEntry

func (*Config) GetInetHttpServer

func (c *Config) GetInetHttpServer() (*ConfigEntry, bool)

Get the inet_http_server configuration section

func (*Config) GetProgram

func (c *Config) GetProgram(name string) *ConfigEntry

return the proram configure entry or nil

func (*Config) GetProgramNames

func (c *Config) GetProgramNames() []string

func (*Config) GetPrograms

func (c *Config) GetPrograms() []*ConfigEntry

func (*Config) GetSupervisorctl

func (c *Config) GetSupervisorctl() (*ConfigEntry, bool)

func (*Config) GetSupervisord

func (c *Config) GetSupervisord() (*ConfigEntry, bool)

get the supervisord section

func (*Config) GetUnixHttpServer

func (c *Config) GetUnixHttpServer() (*ConfigEntry, bool)

get the unix_http_server section

func (*Config) Load

func (c *Config) Load() ([]string, error)

return the loaded programs

func (*Config) RemoveProgram

func (c *Config) RemoveProgram(programName string)

func (*Config) String

func (c *Config) String() string

type ConfigEntry

type ConfigEntry struct {
	ConfigDir string
	Group     string
	Name      string
	// contains filtered or unexported fields
}

func NewConfigEntry

func NewConfigEntry(configDir string) *ConfigEntry

func (*ConfigEntry) GetBool

func (c *ConfigEntry) GetBool(key string, defValue bool) bool

get value of key as bool

func (*ConfigEntry) GetBytes

func (c *ConfigEntry) GetBytes(key string, defValue int) int

get the value of key as the bytes setting.

logSize=1MB
logSize=1GB
logSize=1KB
logSize=1024

func (*ConfigEntry) GetEnv

func (c *ConfigEntry) GetEnv(key string) []string

GetEnv get the value of key as environment setting. An environment string example:

environment = A="env 1",B="this is a test"

func (*ConfigEntry) GetEventListenerName

func (c *ConfigEntry) GetEventListenerName() string

func (*ConfigEntry) GetGroupName

func (c *ConfigEntry) GetGroupName() string

get the group name if this entry is group

func (*ConfigEntry) GetInt

func (c *ConfigEntry) GetInt(key string, defValue int) int

get the value of the key as int

func (*ConfigEntry) GetProgramName

func (c *ConfigEntry) GetProgramName() string

func (*ConfigEntry) GetPrograms

func (c *ConfigEntry) GetPrograms() []string

get the programs from the group

func (*ConfigEntry) GetString

func (c *ConfigEntry) GetString(key string, defValue string) string

get the value of key as string

func (*ConfigEntry) GetStringArray

func (c *ConfigEntry) GetStringArray(key string, sep string) []string

func (*ConfigEntry) GetStringExpression

func (c *ConfigEntry) GetStringExpression(key string, defValue string) string

get the value of key as string and attempt to parse it with StringExpression

func (*ConfigEntry) HasParameter

func (c *ConfigEntry) HasParameter(key string) bool

check if has parameter

func (*ConfigEntry) IsEventListener

func (c *ConfigEntry) IsEventListener() bool

func (*ConfigEntry) IsGroup

func (c *ConfigEntry) IsGroup() bool

func (*ConfigEntry) IsProgram

func (c *ConfigEntry) IsProgram() bool

func (*ConfigEntry) String

func (c *ConfigEntry) String() string

dump the configuration as string

type ProcessGroup

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

func NewProcessGroup

func NewProcessGroup() *ProcessGroup

func (*ProcessGroup) Add

func (pg *ProcessGroup) Add(group string, procName string)

add a process to a group

func (*ProcessGroup) Clone

func (pg *ProcessGroup) Clone() *ProcessGroup

clone the process group

func (*ProcessGroup) ForEachProcess

func (pg *ProcessGroup) ForEachProcess(procFunc func(group string, procName string))

func (*ProcessGroup) GetAllGroup

func (pg *ProcessGroup) GetAllGroup() []string

get all the groups

func (*ProcessGroup) GetAllProcess

func (pg *ProcessGroup) GetAllProcess(group string) []string

get all the processes in a group

func (*ProcessGroup) GetGroup

func (pg *ProcessGroup) GetGroup(procName string, defGroup string) string

func (*ProcessGroup) InGroup

func (pg *ProcessGroup) InGroup(procName string, group string) bool

check if a process belongs to a group or not

func (*ProcessGroup) Remove

func (pg *ProcessGroup) Remove(procName string)

remove a process

func (*ProcessGroup) String

func (pg *ProcessGroup) String() string

func (*ProcessGroup) Sub

func (pg *ProcessGroup) Sub(other *ProcessGroup) (added []string, changed []string, removed []string)

type ProcessSorter

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

func NewProcessSorter

func NewProcessSorter() *ProcessSorter

func (*ProcessSorter) SortProgram

func (p *ProcessSorter) SortProgram(program_configs []*ConfigEntry) []*ConfigEntry

type ProgramByPriority

type ProgramByPriority []*ConfigEntry

func (ProgramByPriority) Len

func (p ProgramByPriority) Len() int

func (ProgramByPriority) Less

func (p ProgramByPriority) Less(i, j int) bool

func (ProgramByPriority) Swap

func (p ProgramByPriority) Swap(i, j int)

type StringExpression

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

func NewStringExpression

func NewStringExpression(envs ...string) *StringExpression

func (*StringExpression) Add

func (se *StringExpression) Add(key string, value string) *StringExpression

func (*StringExpression) Eval

func (se *StringExpression) Eval(s string) (string, error)

Jump to

Keyboard shortcuts

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