conf

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = &MyConfig{
	Name:        "APP",
	LogFile:     "./logs/run.log",
	EnableDebug: true,
	EnableRedis: false,
	EnableMySQL: false,
}

Config instance with default value in global use

Functions

This section is empty.

Types

type MyConfig

type MyConfig struct {
	Name    string
	LogFile string
	// SSL file path
	EnableDebug  bool
	EnableRedis  bool
	EnableMySQL  bool
	RedisConfig  RedisConfig
	MySQLConfig  MySQLConfig
	ServerConfig ServerConfig
}

MyConfig export

type MySQLConfig

type MySQLConfig struct {
	Host     string `default:"127.0.0.1"`
	Port     string `default:"3306"`
	Name     string
	Username string
	Password string
	// connection pool
	MaxOpenConns int
	MaxIdleConns int
	// seconds of maximum amount a connection may be reused
	ConnMaxLifetime int
	Charset         string
	// seconds
	Timeout int
}

MySQLConfig class

type RedisConfig

type RedisConfig struct {
	Host      string `default:"127.0.0.1"`
	Port      string `default:"6379"`
	MaxIdle   int
	MaxActive int
	Password  string
	Db        int `default:"0"`

	// timeout millisecond
	ConnectionTimeout int `default:"30000"`

	// timeout millisecond
	ReadTimeout int `default:"5000"`

	// timeout millisecond
	WriteTimeout int `default:"5000"`

	// timeout second
	IdleTimeout int `default:"300"`
}

RedisConfig struct

type ServerConfig

type ServerConfig struct {
	Host       string
	Port       int
	SSLName    string
	SSLCrtFile string
	SSLKeyFile string
}

ServerConfig struct

Jump to

Keyboard shortcuts

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