config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Container = dig.New()

Functions

func ReadFromEnvironment added in v0.8.0

func ReadFromEnvironment()

ReadFromEnvironment read from system environment

func ReadFromFile added in v0.8.0

func ReadFromFile(path string) error

ReadFromFile read from file

Types

type MnsOptions added in v0.7.6

type MnsOptions struct {
	Url             string `json:"url"`
	AccessKeyId     string `json:"access_key_id"`
	AccessKeySecret string `json:"access_key_secret"`
}

MnsOptions 阿里云MNS 配置项

func Mns added in v0.7.6

func Mns() (options *MnsOptions)

type MysqlOptions

type MysqlOptions struct {
	// auto connect
	AutoConnect bool

	// database name
	Name string

	// host
	Host string

	// port, default 3306
	Port int

	// user, default root
	User string

	// password
	Password string

	// log mode
	LogMode bool

	// MaxIdleConnections, default 10
	MaxIdleConnections int

	// MaxOpenConnections, default 40
	MaxOpenConnections int

	// max life time, default 10
	MaxLifeTime int
}

MysqlOptions

func Mysql added in v0.7.6

func Mysql() (options *MysqlOptions)

func (MysqlOptions) Dsn

func (options MysqlOptions) Dsn() string

Dsn return mysql dsn

type RedisOptions

type RedisOptions struct {
	// AutoConnect
	AutoConnect bool

	// host
	Host string

	// port, default 6379
	Port int

	// auth
	Auth string

	// pool size, default 100
	PoolSize int

	// max retries, default 3
	MaxRetries int

	// timeout, default 10 seconds
	IdleTimeout time.Duration
}

RedisOptions redis配置

func Redis added in v0.7.6

func Redis() (options *RedisOptions)

func (*RedisOptions) Options

func (conf *RedisOptions) Options() *redis.Options

Options get redis options

type ServerOptions added in v0.7.6

type ServerOptions struct {
	// 服务名称
	Name string

	// 服务端口号
	Port int

	// 响应日志最大长度
	MaxResponseLogSize int

	// 日志路径
	LogPath string
	// jwt的key
	JwtSignKey []byte

	// trace header key
	TraceHeader string

	// http request timeout
	HttpRequestTimeOut int
}

ServerOptions 服务配置

func Server added in v0.7.6

func Server() (options *ServerOptions)

Server return server config

Jump to

Keyboard shortcuts

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