config

package
v0.0.0-...-28a21d3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C = new(Config)
)

Functions

func LoadConfig

func LoadConfig()

Types

type CORS

type CORS struct {
	Enable           bool     `yaml:"enable"`
	AllowOrigins     []string `yaml:"allowOrigins"`
	AllowMethods     []string `yaml:"allowMethods"`
	AllowHeaders     []string `yaml:"allowHeaders"`
	AllowCredentials bool     `yaml:"allowCredentials"`
	MaxAge           int      `yaml:"maxAge"`
}

type Config

type Config struct {
	RunMode string  `yaml:"runMode"`
	Swagger bool    `yaml:"swagger"`
	Log     Log     `yaml:"log"`
	HTTP    HTTP    `yaml:"http"`
	MySQL   MySQL   `yaml:"mysql"`
	Monitor Monitor `yaml:"monitor"`
	CORS    CORS    `yaml:"cores"`
	GZIP    GZIP    `yaml:"gzip"`
}

type GZIP

type GZIP struct {
	Enable bool `yaml:"enable"`
}

type HTTP

type HTTP struct {
	Addr            string `yaml:"addr"`
	CertFile        string `yaml:"certFile"`
	KeyFile         string `yaml:"keyFile"`
	ShutdownTimeout int    `yaml:"shutdownTimeout"`
}

type Log

type Log struct {
	Level  string `yaml:"level"`
	Format string `yaml:"format"`
}

type Monitor

type Monitor struct {
	Enable    bool   `yaml:"enable"`
	Addr      string `yaml:"addr"`
	ConfigDir string `yaml:"configDir"`
}

type MySQL

type MySQL struct {
	Host       string `yaml:"host"`
	Port       int    `yaml:"port"`
	User       string `yaml:"user"`
	Password   string `yaml:"password"`
	DBName     string `yaml:"dbName"`
	Parameters string `yaml:"parameters"`

	MaxLifetime  int `yaml:"maxLifetime"`
	MaxOpenConns int `yaml:"maxOpenConns"`
	MaxIdleConns int `yaml:"maxIdleConns"`
}

MySQL mysql配置参数

func (MySQL) DSN

func (a MySQL) DSN() string

DSN 数据库连接串

Jump to

Keyboard shortcuts

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