Documentation ¶
Index ¶
- Variables
- type Config
- func (c *Config) ClonePrograms() []*ConfigEntry
- func (c *Config) GetConfigFileDir() string
- func (c *Config) GetEntries(filterFunc func(entry *ConfigEntry) bool) []*ConfigEntry
- func (c *Config) GetEventListeners() []*ConfigEntry
- func (c *Config) GetGroups() []*ConfigEntry
- func (c *Config) GetInetHttpServer() (*ConfigEntry, bool)
- func (c *Config) GetProgram(name string) *ConfigEntry
- func (c *Config) GetProgramNames() []string
- func (c *Config) GetPrograms() []*ConfigEntry
- func (c *Config) GetSupervisorctl() (*ConfigEntry, bool)
- func (c *Config) GetSupervisord() (*ConfigEntry, bool)
- func (c *Config) GetUnixHttpServer() (*ConfigEntry, bool)
- func (c *Config) Load() ([]string, error)
- func (c *Config) RemoveProgram(programName string)
- func (c *Config) String() string
- type ConfigEntry
- func (c *ConfigEntry) GetBool(key string, defValue bool) bool
- func (c *ConfigEntry) GetBytes(key string, defValue int) int
- func (c *ConfigEntry) GetEnv(key string) []string
- func (c *ConfigEntry) GetEventListenerName() string
- func (c *ConfigEntry) GetGroupName() string
- func (c *ConfigEntry) GetInt(key string, defValue int) int
- func (c *ConfigEntry) GetProgramName() string
- func (c *ConfigEntry) GetPrograms() []string
- func (c *ConfigEntry) GetString(key string, defValue string) string
- func (c *ConfigEntry) GetStringArray(key string, sep string) []string
- func (c *ConfigEntry) GetStringExpression(key string, defValue string) string
- func (c *ConfigEntry) HasParameter(key string) bool
- func (c *ConfigEntry) IsEventListener() bool
- func (c *ConfigEntry) IsGroup() bool
- func (c *ConfigEntry) IsProgram() bool
- func (c *ConfigEntry) KeyValues() map[string]string
- func (c *ConfigEntry) String() string
- type ProcessGroup
- func (pg *ProcessGroup) Add(group string, procName string)
- func (pg *ProcessGroup) Clone() *ProcessGroup
- func (pg *ProcessGroup) ForEachProcess(procFunc func(group string, procName string))
- func (pg *ProcessGroup) GetAllGroup() []string
- func (pg *ProcessGroup) GetAllProcess(group string) []string
- func (pg *ProcessGroup) GetGroup(procName string, defGroup string) string
- func (pg *ProcessGroup) InGroup(procName string, group string) bool
- func (pg *ProcessGroup) Remove(procName string)
- func (pg *ProcessGroup) String() string
- func (pg *ProcessGroup) Sub(other *ProcessGroup) (added []string, changed []string, removed []string)
- type ProcessSorter
- type ProgramByPriority
- type StringExpression
Constants ¶
This section is empty.
Variables ¶
var ConfKey = []byte{}
var Decode = func(src, key []byte) ([]byte, error) { return src, nil }
Implement decrypt by user.
var Encode = func(src, key []byte) []byte {
return src
}
Implement encrypt by user.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ProgramGroup *ProcessGroup // contains filtered or unexported fields }
func (*Config) ClonePrograms ¶
func (c *Config) ClonePrograms() []*ConfigEntry
func (*Config) GetConfigFileDir ¶
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 (*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) RemoveProgram ¶
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) KeyValues ¶
func (c *ConfigEntry) KeyValues() map[string]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) 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) 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