config

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(file string)

配置文件初始化读取

func SetConfigFile

func SetConfigFile(file string)

Types

type Config

type Config struct {
	I
}

func New

func New() *Config

type Core

type Core struct {
}

type Etcd

type Etcd struct {
	Addr []string
}

mysql数据库配置

func GetEtcd

func GetEtcd() *Etcd

type I

type I interface {
	SetDefault(key string, value string)             //设置默认值,最低优先级
	Set(key string, value interface{})               //设置配置 原有将覆盖
	BindEnv(key string, envName string)              //绑定环境变量
	GetBool(key string) bool                         // 获取 bool
	GetFloat64(key string) float64                   // 获取 Float64
	GetInt(key string) int                           // 获取Int
	GetIntSlice(key string) []int                    // 获取 []int
	GetString(key string) string                     // 获取 string
	GetStringMap(key string) map[string]interface{}  // 获取 map[string]interface{}
	GetStringMapString(key string) map[string]string // 获取 map[string]string
	GetStringSlice(key string) []string              // 获取 []string
	IsSet(key string) bool                           // 判断配置是否存在
	AllSettings() map[string]interface{}             //获取全部配置文件
	//获取配置信息 可以通过Struct和字符串获取  备注:具体的Struct 写在configStruct.go
	Get(rawVal interface{}, key ...string) (err error)
}

type JwtCnf

type JwtCnf struct {
	Secret string
	Issuer string
	Expire int64
	Ttl    int
}

jwt 配置

func GetJwtCnf

func GetJwtCnf() *JwtCnf

type Mongo

type Mongo struct {
	Host []string
	Uri  string
}

func GetMongo

func GetMongo() Mongo

GetMongo

type MySQL

type MySQL struct {
	Host        string
	Port        int
	User        string
	Password    string
	Database    string
	Parameters  string
	MaxIdleConn int
	MaxOpenConn int
}

MySQL mysql数据库配置

func GetMySQL

func GetMySQL() *MySQL

Jump to

Keyboard shortcuts

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