config

package
v0.0.0-...-27e8298 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultTags      = "test"
	DefaultFrontPort = ":12306"
	DefaultAdminPort = ":12307"
)
View Source
const (
	// AgentHeartbeat 为 Agent 发送心跳的间隔
	AgentHeartbeat = 10
	// AgentHeartbeatTimes 为了防止心跳一次没法成功就导致 ETCD 认为 Agent 断线,设置 TTL 时,将心跳时间 * 心跳次数
	AgentHeartbeatTimes = 3
)

Variables

View Source
var (
	NodeID  string
	Storage *backend.Storage
)
View Source
var RemoteConf = func() *Setting {
	return setting.Load().(*Setting)
}

Functions

func GetRemoteConfig

func GetRemoteConfig(ctx context.Context) error

func Init

func Init(ctx context.Context) error

func UpdateConf

func UpdateConf(conf *Setting)

Types

type Setting

type Setting struct {
	SettingGlobal
	SettingNode
}

Setting 配置

type SettingGlobal

type SettingGlobal struct {
	FrontPort string `json:"front_port"`
	AdminPort string `json:"admin_port"`

	JobResultTimesStorage *SettingJobResultStorage `json:"job_result_times_storage"`
	JobResultStorage      *SettingJobResultStorage `json:"job_result_storage"`
}

SettingGlobal 全局配置

type SettingJobResultStorage

type SettingJobResultStorage struct {
	Type        string        `json:"type"`
	Addr        string        `json:"addr"`
	Auth        string        `json:"auth"`
	MaxConnNum  int           `json:"max_conn_num"`
	IdleTimeout time.Duration `json:"idle_timeout"`
	User        string        `json:"user"`
	Database    string        `json:"database"`
}

SettingJobResultStorage Job 结果存储

type SettingNode

type SettingNode struct {
	Tags string `json:"tags"`
}

SettingNode 节点配置

Jump to

Keyboard shortcuts

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