config

package
v0.0.0-...-e027c79 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPName  = "grow"
	ConfName = "conf.yaml"
)

constant

Variables

View Source
var (
	Version   string
	BuildInfo *BuildData
)

从编译参数中获取

View Source
var DefOption = &ConfOption{
	Serve: &ServeOption{
		HTTPListening: ":9999",
		Debug:         false,
	},
	MYSQLMaster: gxdb.DefOption,
	Redis:       gxdb.DefRedisOption,

	Auth: &AuthOption{
		Debug:               true,
		ExpirePeriodSeconds: 60 * 60 * 2,
		SingleLogin:         true,
		VerifyIP:            true,
	},
}

DefOption 默认配置

Functions

func MustGetRootPath

func MustGetRootPath() string

MustGetRootPath must maybe panic

func Sync

func Sync() (err error)

Sync ...读取配置文件,或者初始化一个配置文件以待配置

Types

type AuthOption

type AuthOption struct {
	Debug bool `yaml:"debug" mapstructure:"debug"`
	//令牌超时秒数
	ExpirePeriodSeconds int64 `yaml:"expire_period_seconds" mapstructure:"expire_period_seconds"`
	//是否是单点登录
	SingleLogin bool `yaml:"single_login" mapstructure:"single_login"`
	//是否验校IP
	VerifyIP bool `yaml:"verify_ip" mapstructure:"verify_ip"`
}

AuthOption ...

type BuildData

type BuildData struct {
	GoVersion string
	BuildTime string
	GitBranch string
	GitHash   string
}

BuildData 编译信息

type ConfOption

type ConfOption struct {
	Serve       *ServeOption      `yaml:"serve" mapstructure:"serve"`
	MYSQLMaster *gxdb.Option      `yaml:"mysql_master" mapstructure:"mysql_master"`
	Redis       *gxdb.RedisOption `yaml:"redis" mapstructure:"redis"`
	Auth        *AuthOption       `yaml:"auth" mapstructure:"auth"`
}

ConfOption 配置设置

type ServeOption

type ServeOption struct {
	HTTPListening string `yaml:"http_listening" mapstructure:"http_listening"`
	Debug         bool   `yaml:"debug" mapstructure:"debug"`
}

ServeOption 服务器配置

Jump to

Keyboard shortcuts

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