config

package
v0.0.0-...-2431c21 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalConfig = &Config{
	Log: Log{
		DisableTimestamp: false,
		Level:            "info",
		Format:           "text",
		FileName:         "./log/data.log",
		MaxSize:          20,
	},
	Etcd: Etcd{
		Endpoints: []string{
			"127.0.0.1:2379",
		},
	},
	MySQL: MySQL{
		DSN:     "root:root@tcp(127.0.0.1:3306)/robber?charset=utf8mb4&parseTime=true&loc=Local",
		MinOpen: 5,
		MaxOpen: 10,
	},
	Server: Server{
		Host: "0.0.0.0",
		Port: 27323,
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Log    Log    `json:"log" toml:"log"`
	MySQL  MySQL  `json:"mysql" toml:"mysql"`
	Etcd   Etcd   `json:"etcd" toml:"etcd"`
	Server Server `json:"server" toml:"server"`
}

func (*Config) Load

func (c *Config) Load(path string, override func(cfg *Config)) 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"`
	FileName         string `json:"filename" toml:"filename"`
	MaxSize          int    `json:"maxsize" toml:"maxsize"`
}

type MySQL

type MySQL struct {
	DSN     string `json:"dsn" toml:"dsn"`
	MinOpen int    `json:"min-open" toml:"min-open"`
	MaxOpen int    `json:"max-open" toml:"max-open"`
}

type Server

type Server struct {
	Host string `json:"host" toml:"host"`
	Port int    `json:"port" toml:"port"`
}

Jump to

Keyboard shortcuts

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