settings

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

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,
	}
)

Functions

func LoadSettings

func LoadSettings(filename string) error

GetSettings loads main settings from a filename

Types

type After

type After string

func (After) Weight

func (a After) Weight() int64

type AppSettings

type AppSettings struct {
	Main struct {
		MaxJobs  int
		Include  []string
		Network  string
		LogLevel string
	}

	Globals Globals

	Sink map[string]SinkConfig

	Extension map[string]Extension

	Logging map[string]Logger

	Stats struct {
		//Interval is deprecated
		Interval int
		Redis    struct {
			Enabled       bool
			FlushInterval int //in seconds
			Address       string
		}
	}
}

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 Extension

type Extension struct {
	//binary to execute
	Binary string
	//script search path
	Cwd string
	//(optional) Env variables
	Env map[string]string

	Args []string
	// contains filtered or unexported fields
}

Extension cmd config

func (*Extension) Key

func (e *Extension) Key() string

type Globals added in v0.10.0

type Globals map[string]string

func (Globals) Get added in v0.10.0

func (g Globals) Get(key string, def ...string) string

type IncludedSettings

type IncludedSettings struct {
	Extension map[string]Extension
	Startup   map[string]Startup
}

func (*IncludedSettings) GetStartupTree

func (i *IncludedSettings) GetStartupTree() (StartupTree, []error)

type Logger

type Logger struct {
	//logger type, now only 'db' and 'ac' are supported
	Type string
	//list of controlles base URLs
	Controllers []string
	//Process which levels
	Levels []int

	//Log address (for loggers that needs it)
	Address string
	//Flush interval (for loggers that needs it)
	FlushInt int
	//Flush batch size (for loggers that needs it)
	BatchSize int
}

Logger settings

type Security

type Security struct {
	CertificateAuthority string
	ClientCertificate    string
	ClientCertificateKey string
}

Security certificate path

type SinkConfig

type SinkConfig struct {
	URL      string
	Password string
}

Controller url and certificates

type Startup

type Startup struct {
	After           []string
	RunningDelay    int
	RunningMatch    string
	RecurringPeriod int
	MaxRestart      int
	Name            string
	Args            map[string]interface{}
	// contains filtered or unexported fields
}

StartupCmd startup command config

func (Startup) Key

func (s Startup) Key() string

func (Startup) String

func (s Startup) String() string

func (Startup) Weight

func (s Startup) Weight(i *IncludedSettings, chain ...string) (int64, error)

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
}

Jump to

Keyboard shortcuts

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