config

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 3 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 {
	Main    Main    `yaml:"main"`
	Http    Http    `yaml:"http"`
	Redis   Redis   `yaml:"redis"`
	MySQL   MySQL   `yaml:"mysql"`
	MongoDB MongoDB `yaml:"mongodb"`
}

func GlobConfig

func GlobConfig() Config

func Init

func Init() (cfg Config, err error)

type Http

type Http struct {
	// MainListenPort 启用Main HTTP服务的监听端口
	MainListenPort int `yaml:"main_listen_port"`

	// PprofListenPort 启用 Pprof HTTP服务的监听端口
	PprofListenPort int `yaml:"pprof_listen_port"`
}

type Main

type Main struct {
	JwtSigningKey string `yaml:"jwt_signing_key"`
	ServerName    string `yaml:"server_name"`
}

type MongoDB

type MongoDB struct {
	// URI 连接地址; example: mongodb://[ip1]:[port1],[ip2]:[port2],[ip3]:[port3]/?replicaSet=rs0&authSource=admin&readPreference=secondary
	URI string `yaml:"uri"`

	// MainDB 主数据库名
	MainDB string `yaml:"main_db"`
}

type MySQL

type MySQL struct {
	// URI 连接地址; example: root:root@tcp([ip]:[port])/?charset=utf8&parseTime=true&loc=Local
	URI string `yaml:"uri"`

	// MainDB 主数据库名
	MainDB string `yaml:"main_db"`
}

type Redis

type Redis struct {
	// Mode 模式
	// 支持:single,sentinel,cluster
	Mode string `yaml:"mode"`

	// MasterName 主库名称; 当选择哨兵模式时需要填写
	MasterName string   `yaml:"master_name"`
	Addrs      []string `yaml:"addrs"`
	Database   string   `yaml:"database"`
	Username   string   `yaml:"username"`
	Password   string   `yaml:"password"`
}

Jump to

Keyboard shortcuts

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