conf

package
v0.0.0-...-d2b7790 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Global = Config{
	ServiceName: "rogue-collector",
	App: App{
		HttpHost: "",
		HttpPort: 0,
	},
	Etcd: Etcd{
		Endpoints: []string{"127.0.0.1:2379"},
	},
	MongoDB: MongoDB{
		DSN: "mongodb://127.0.0.1:27017",
	},
	Collect: Collect{
		Source: "net126",
		CodeList: []string{
			"sh688***",
			"sh605***",
			"sh603***",
			"sh601***",
			"sh600***",
			"sz300***",
			"sz0030**",
			"sz002***",
			"sz001**",
			"sz000***",
		},
		Crontab:    "05 17 * * MON,TUE,WED,THU,FRI",
		RandomWait: "10,30",
	},
	Log: Log{
		DisableTimestamp: false,
		Level:            "info",
		Format:           "text",
		MaxSize:          20,
		Dir:              "../log",
	},
}

Functions

func SetupLogger

func SetupLogger(l Log) ([]func() error, error)

Types

type App

type App struct {
	HttpHost string `json:"http-host" toml:"http-host"`
	HttpPort int    `json:"http-port" toml:"http-port"`
}

type Collect

type Collect struct {
	Source     string   `json:"source" toml:"source"`
	CodeList   []string `json:"code-list" toml:"code-list"`
	Crontab    string   `json:"crontab" toml:"crontab"`
	RandomWait string   `json:"random-wait" toml:"random-wait"`
}

type Config

type Config struct {
	ServiceName string  `json:"service-name" toml:"service-name"`
	App         App     `json:"app" toml:"app"`
	Etcd        Etcd    `json:"etcd" toml:"etcd"`
	MongoDB     MongoDB `json:"mongodb" toml:"mongodb"`
	Collect     Collect `json:"collect" toml:"collect"`
	Log         Log     `json:"log" toml:"log"`
}

func (*Config) FindAndLoad

func (c *Config) FindAndLoad(path string, override []func(cfg *Config) error) error

func (*Config) String

func (cg *Config) String() string

type Etcd

type Etcd struct {
	Endpoints []string `json:"endpoints" toml:"endpoints"`
}

type Log

type Log struct {
	DisableTimestamp bool   `json:"disable-timestamp" toml:"disable-timestamp"`
	Level            string `json:"level" toml:"level"`
	Format           string `json:"format" toml:"format"`
	MaxSize          int    `json:"maxsize" toml:"maxsize"`
	Dir              string `json:"dir" toml:"dir"`
}

type MongoDB

type MongoDB struct {
	DSN string `json:"dsn" toml:"dsn"`
}

Jump to

Keyboard shortcuts

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