Documentation
¶
Index ¶
Constants ¶
View Source
const ( //Init happens before handshake AfterInit = After("init") //Core happens with core is up and running (also networking) AfterNet = After("net") //Default for startup commands that doesn't specify dependency AfterBoot = After("boot") ToTheEnd = After("----") )
View Source
const (
//ConfigSuffix config file ext
ConfigSuffix = ".toml"
)
Variables ¶
View Source
var ( CyclicDependency = fmt.Errorf("cyclic dependency") Priority = map[After]int64{ AfterInit: 1, AfterNet: 1000, AfterBoot: 1000000, ToTheEnd: -1, } )
View Source
var ( //EOL parser has reached end of expression EOL = fmt.Errorf("end of line") )
Functions ¶
func LoadSettings ¶
GetSettings loads main settings from a filename
Types ¶
type AppSettings ¶
type AppSettings struct {
Main struct {
MaxJobs int `json:"max_jobs"`
Include []string `json:"include"`
Network string `json:"network"`
LogLevel string `json:"log_level"` //deprecated (not used)
} `json:"main"`
Globals Globals `json:"globals"`
Extension map[string]Extension `json:"extension"`
Logging struct {
File Logger `json:"file"`
Ledis struct {
Logger `json:"ledis"`
Size int64 `json:"size"`
}
} `json:"logger"`
Containers struct {
MaxCount int `json:"max_count"`
} `json:"containers"`
Stats struct {
Enabled bool `json:"enabled"`
} `json:"stats"`
}
Settings main agent settings
var Settings AppSettings
func (*AppSettings) GetIncludedSettings ¶
func (s *AppSettings) GetIncludedSettings() (partial *IncludedSettings, errors []error)
GetPartialSettings loads partial settings according to main configurations
func (*AppSettings) Validate ¶
func (s *AppSettings) Validate() []error
type Expression ¶ added in v1.2.0
Expression represents a loaded expression
func GetExpression ¶ added in v1.2.0
func GetExpression(expression string) (Expression, error)
GetExpression gets an expression object from string, empty string always evaluates to a `true` expression.
type Extension ¶
type Extension struct {
//binary to execute
Binary string `json:"binary"`
//script search path
Cwd string `json:"cwd"`
//(optional) Env variables
Env map[string]string `json:"env"`
Args []string `json:"args"`
// contains filtered or unexported fields
}
Extension cmd config
type IncludedSettings ¶
type IncludedSettings struct {
Extension map[string]Extension
Startup map[string]Startup
// contains filtered or unexported fields
}
func (*IncludedSettings) GetStartupTree ¶
func (i *IncludedSettings) GetStartupTree() (StartupTree, []error)
type Security ¶
type Security struct {
CertificateAuthority string
ClientCertificate string
ClientCertificateKey string
}
Security certificate path
type Startup ¶
type Startup struct {
After []string
RunningDelay int
RunningMatch string
RecurringPeriod int
MaxRestart int
Protected bool
Name string
Tags []string
Args map[string]interface{}
Condition string
// contains filtered or unexported fields
}
StartupCmd startup command config
type StartupSlice ¶
type StartupSlice []Startup
type StartupTree ¶
type StartupTree interface {
//Services a list of sorted startup services based on service weights.
Services() []Startup
//Slice gets a slice of the sorted start up processes that are lying between a
//certain weight range. e can be set to -1 which means (end of list)
//[s, e[
Slice(s, e int64) StartupSlice
}
Click to show internal directories.
Click to hide internal directories.