config

package
v0.0.0-...-0248c43 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiConfig

type ApiConfig struct {
	Enable    bool
	Port      string
	BasicAuth BasicAuthConfig `yaml:"basic_auth"`
}

type BasicAuthConfig

type BasicAuthConfig struct {
	Enable   bool
	Username string
	Password string
}

type Config

type Config struct {
	Storage map[string]interface{}
	Rules   []RuleConfig
	Alert   map[string]interface{}
	ApiInfo ApiConfig `yaml:"api"`
	Test    bool
}

Config 全部配置

var (
	OriginConfig *Config
)

func IntiConfig

func IntiConfig(configDirInfo ConfigDirInfo) (config *Config, err error)

IntiConfig 根据配置文件路径加载配置

func (Config) Valid

func (config Config) Valid() error

Valid 验证config信息 TODO 更详细的验证信息

type ConfigDirInfo

type ConfigDirInfo struct {
	Dir        string
	RuleName   string
	ConfigName string
}

type ConfigError

type ConfigError struct {
	Message string
}

func (ConfigError) Error

func (error ConfigError) Error() string

type RuleConfig

type RuleConfig struct {
	Name     string
	Status   int
	Storage  map[string]interface{}
	Script   string
	Test     TestRuleData
	Interval Time
	Alerts   []map[string]interface{}
}

RuleConfig 规则配置

func GetRuleConfig

func GetRuleConfig(ruleDir string) (RuleConfig, error)

type TestRuleData

type TestRuleData struct {
	Data   string
	Should bool
}

type Time

type Time map[string]int32

Time 语义相关的时间 such as ["day:1","hour":2,"second": 30] = 1天2小时30秒

func (Time) GetSecond

func (t Time) GetSecond() int32

GetSecond 根据时间信息获取秒数

Jump to

Keyboard shortcuts

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