config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: MIT Imports: 5 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 {
	Core  *ConfigCore  `yaml:"core"`
	Log   *ConfigLog   `yaml:"log"`
	Db    *ConfigDb    `yaml:"db"`
	Mail  *ConfigMail  `yaml:"mail"`
	Cache *ConfigCache `yaml:"cache"`
}

Config 配置对象

func Init

func Init(filePath string) (*Config, error)

Init initializes config pkg.

func LoadConfig

func LoadConfig(filePath string) (*Config, error)

LoadConfig 加载配置文件

type ConfigAutoTLS

type ConfigAutoTLS struct {
	Enabled bool   `yaml:"enabled"`
	Folder  string `yaml:"folder"`
	Host    string `yaml:"host"`
}

ConfigAutoTLS support Let's Encrypt setting.

type ConfigCache

type ConfigCache struct {
	Type    string            `yaml:"type"`
	Timeout int32             `yaml:"timeout"`
	Redis   *ConfigCacheRedis `yaml:"redis"`
}

ConfigCache is sub section of config

type ConfigCacheRedis

type ConfigCacheRedis struct {
	Host      string `yaml:"host"`
	Port      int    `yaml:"port"`
	Password  string `yaml:"password"`
	DB        int    `yaml:"db"`
	KeyPrefix string `yaml:"keyprefix"`
}

ConfigCacheRedis is sub section of config

type ConfigCore

type ConfigCore struct {
	Enabled      bool           `yaml:"enabled"`
	Mode         string         `yaml:"mode"`
	Name         string         `yaml:"name"`
	Host         string         `yaml:"host"`
	Port         string         `yaml:"port"`
	MaxPingCount int            `yaml:"max_ping_count"`
	JwtSecret    string         `yaml:"jwt_secret"`
	TLS          *ConfigTLS     `yaml:"tls"`
	AutoTLS      *ConfigAutoTLS `yaml:"auto_tls"`
}

ConfigCore ...

type ConfigDb

type ConfigDb struct {
	Unix            string `yaml:"unix"`
	Host            string `yaml:"host"`
	Port            string `yaml:"port"`
	Charset         string `yaml:"charset"`
	Dialect         string `yaml:"dialect"`
	DbName          string `yaml:"db_name"`
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	TablePrefix     string `yaml:"table_prefix"`
	MaxIdleConns    int    `yaml:"max_idle_conns"`
	MaxOpenConns    int    `yaml:"max_open_conns"`
	ConnMaxLifeTime int    `yaml:"conn_max_lift_time"`
	LogMode         bool   `yaml:"log_mode"`
}

ConfigDb is sub section of config.

type ConfigLog

type ConfigLog struct {
	DefaultDir string            `yaml:"default_dir"`
	Console    *ConfigLogConsole `yaml:"console"`
	Zap        *ConfigLogZap     `yaml:"zap"`
}

ConfigLog is sub section of config.

type ConfigLogConsole

type ConfigLogConsole struct {
	Color  bool   `yaml:"color"`
	Prefix string `yaml:"prefix"`
	Level  string `yaml:"level"`
}

type ConfigLogZap

type ConfigLogZap struct {
	Path  string `yaml:"path"`
	Level string `yaml:"level"`
}

type ConfigMail

type ConfigMail struct {
	Enable   bool   `yaml:"enable"`
	Smtp     string `yaml:"smtp_host"`
	Port     int    `yaml:"smtp_port"`
	Username string `yaml:"smtp_username"`
	Password string `yaml:"smtp_password"`
}

ConfigMail is sub section of config

type ConfigTLS

type ConfigTLS struct {
	Port     string `yaml:"port"`
	CertPath string `yaml:"cert_path"`
	KeyPath  string `yaml:"key_path"`
}

ConfigTLS support tls

Jump to

Keyboard shortcuts

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