config

package
v0.0.0-...-f16d494 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug        bool         `toml:"debug"`
	APIKey       string       `toml:"api_key"`
	APISecret    string       `toml:"api_secret"`
	FacesetToken string       `toml:"faceset_token"`
	FaceType     string       `toml:"face_type"`
	Cmd          string       `toml:"cmd"`
	Http         *HTTPConfig  `toml:"http"`
	MySQL        *MySQLConfig `toml:"mysql"`
}

Config 系统根配置

var CFG *Config

func NewConfig

func NewConfig(cfgPath string) (*Config, error)

NewConfig 初始化一个配置文件对象

type Duration

type Duration struct {
	time.Duration
}

Duration 用于日志文件解析出时间段

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type HTTPConfig

type HTTPConfig struct {
	Address string `toml:"address"`
	Port    int    `toml:"port"`
}

HTTPConfig http监听配置

func (*HTTPConfig) Init

func (hc *HTTPConfig) Init()

Init http配置

type MySQLConfig

type MySQLConfig struct {
	Debug        bool     `toml:"debug"`          // 是否调试模式
	Address      string   `toml:"address"`        // 数据库连接地址
	Port         int      `toml:"port"`           // 数据库端口
	MaxIdleConns int      `toml:"max_idle_conns"` // 连接池最大连接数
	MaxOpenConns int      `toml:"max_open_conns"` // 默认打开连接数
	User         string   `toml:"user"`           // 数据库用户名
	Passwd       string   `toml:"passwd"`         // 数据库密码
	DbName       string   `toml:"db_name"`        // 数据库名
	Prefix       string   `toml:"prefix"`         // 数据库表前缀
	PingInterval Duration `toml:"ping_interval"`  // 定时保活定
}

MySQLConfig 数据库配置

func (*MySQLConfig) Init

func (db *MySQLConfig) Init()

Init 初始化数据库配置

Jump to

Keyboard shortcuts

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