Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Watcher ¶
Auto reload config. copy from https://github.com/spf13/viper/blob/v1.12.0/viper.go#L431
Types ¶
type App ¶
type App struct { Name string `env-required:"true" yaml:"name" env:"APP_NAME"` Debug bool `yaml:"debug" env:"APP_DEBUG"` SuperUser string `env-required:"true" yaml:"superUser" env:"APP_SUPER_USER"` // Please changed when app first started. SuperPassword string `env-required:"true" yaml:"superPassword" env:"APP_SUPER_PASSWORD"` }
App -.
type Config ¶
type Config struct { App `yaml:"app"` HTTP `yaml:"http"` Log `yaml:"log"` MySQL `yaml:"mysql"` //nolint: tagliatelle Redis `yaml:"redis"` }
Config -.
func LoadConfig ¶
default cfg file: "./config/config.yml".
type HTTP ¶
type HTTP struct {
Port string `env-required:"true" yaml:"port" env:"HTTP_PORT"`
}
HTTP -.
type Log ¶
type Log struct { // debug, info, warn, error Level string `env-required:"true" yaml:"level" env:"LOG_LEVEL"` // output format, json/text Format string `env-required:"true" yaml:"format" env:"LOG_FORMAT"` // nocolor, default false NoColor bool `yaml:"noColor" env:"LOG_NOCOLOR"` }
Log -.
type MySQL ¶
type MySQL struct { // https://github.com/go-sql-driver/mysql#dsn-data-source-name DSN string `env-required:"true" env:"MYSQL_DSN"` // https://github.com/go-sql-driver/mysql#important-settings ConnMaxLifetime int `env-required:"true" yaml:"connMaxLifetime" env:"MYSQL_CONN_MAX_LIFETIME"` MaxOpenConns int `env-required:"true" yaml:"maxOpenConns" env:"MYSQL_MAX_OPEN_CONNS"` MaxIdleConns int `env-required:"true" yaml:"maxIdleConns" env:"MYSQL_MAX_IDLE_CONNS"` }
MySQL -.
Click to show internal directories.
Click to hide internal directories.