conf

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnURL

func GetConnURL(info *DBConfigInfo) (url string)

func ParseConfig

func ParseConfig(fpath string, conf *GatewayMainConfig) error

ParseConfig 解析配置文件

Types

type AppConfig

type AppConfig struct {
	HttpPort int    `toml:"httpPort"`
	Name     string `toml:"name"`
	Enabled  bool   `toml:"enabled"`
	Time     string `toml:"time"`
	RpcPort  int    `toml:"rpcPort"`
	Testing  bool   `toml:"testing"`
}

type Cache

type Cache struct {
	Redis RedisConfig `toml:"redis"`
}

缓存

type DB

type DB struct {
	Master DBConfigInfo
	Slave  DBConfigInfo
}

type DBConfigInfo

type DBConfigInfo struct {
	Dialect      string `toml:"dialect"`
	User         string `toml:"user"`
	Password     string `toml:"password"`
	Host         string `toml:"host"`
	Port         int    `toml:"port"`
	Database     string `toml:"database"`
	Charset      string `toml:"charset"`
	ShowSql      bool   `toml:"showSql"`
	LogLevel     string `toml:"logLevel"`
	MaxOpenConns int    `toml:"maxOpenConns"`
	MaxIdleConns int    `toml:"maxIdleConns"`
	//ParseTime       bool   `toml:"parseTime"`
	//MaxIdleConns    int    `toml:"maxIdleConns"`
	//MaxOpenConns    int    `toml:"maxOpenConns"`
	ConnMaxLifetime int64 `toml:"connMaxLifetime"`
}

type DBEngines

type DBEngines struct {
	DbMasterConfigInfo *DBConfigInfo
	DbSlaveConfigInfo  *DBConfigInfo
	// contains filtered or unexported fields
}

func (*DBEngines) MasterEngine

func (dbConfig *DBEngines) MasterEngine() *xorm.Engine

主库,单例

func (*DBEngines) SlaveEngine

func (dbConfig *DBEngines) SlaveEngine() *xorm.Engine

从库,单例

type DbConfig

type DbConfig struct {
	Db map[string]DBConfigInfo `toml:"db"`
}

数据库的配置

type Etcd

type Etcd struct {
	Urls []string `toml:"Urls"`
}

type GatewayMainConfig

type GatewayMainConfig struct {
	GatewayWebConfig GatewayWebConfig `toml:"gateway"`
}

type GatewayWebConfig

type GatewayWebConfig struct {
	Addr       string     `toml:"addr"`
	LogLevel   string     `toml:"loglevel"`
	IrisConfig IrisConfig `toml:"irisconfig"`
	Other      Other      `toml:"other"`
}

Config 配置参数

type GatewayWebConfigRefKey

type GatewayWebConfigRefKey struct{}

type IrisConfig

type IrisConfig struct {
	DisablePathCorrection             bool   `toml:"DisablePathCorrection"`
	EnablePathEscape                  bool   `toml:"EnablePathEscape"`
	FireMethodNotAllowed              bool   `toml:"FireMethodNotAllowed"`
	DisableBodyConsumptionOnUnmarshal bool   `toml:"DisableBodyConsumptionOnUnmarshal"`
	TimeFormat                        string `toml:"TimeFormat"`
	Charset                           string `toml:"Charset"`
}

func (*IrisConfig) ConvertIrisConfig

func (conf *IrisConfig) ConvertIrisConfig() (iconf iris.Configuration)

type Jobs

type Jobs struct {
	Name           string `toml:"name"`
	RefundInterval string `toml:"refundInterval"`
}

jobs

type LogConfig

type LogConfig struct {
	EnableLineLog bool   `toml:"enableLineLog"`
	Dir           string `toml:"dir"`
	TestDir       string `toml:"testDir"`
	FileName      string `toml:"fileName"`
	// 文件最大保存时间
	MaxAge string `toml:"maxAge"` // = "24h"
	// 日志切割时间间隔
	RotationTime string `toml:"rotationTime"` //	= "1h"
	Level        string `toml:"level"`        //= "debug"
}

type Other

type Other struct {
	Port       int      `toml:"Port"`
	IgnoreURLs []string `toml:"IgnoreURLs"`
	JWTTimeout int      `toml:"JWTTimeout"`
	LogLevel   string   `toml:"LogLevel"`
	Secret     string   `toml:"Secret"`
}

func (*Other) ConvertOtherToMap

func (o *Other) ConvertOtherToMap() (map[string]interface{}, error)

type RedisConfig

type RedisConfig struct {
	Addr      string `toml:"addr"`
	MaxIdle   int    `toml:"maxIdle"`
	MaxActive int    `toml:"maxActive"`
	Timeout   string `toml:"timeout"`
}

type Registry

type Registry struct {
	Etcd Etcd `toml:"etcd"`
}

注册中心配置

type ServerRefKey

type ServerRefKey struct{}

type TomlConfig

type TomlConfig struct {
	App AppConfig              `toml:"app"`
	Log LogConfig              `toml:"log"`
	Ext map[string]interface{} `toml:"ext"`
}

Jump to

Keyboard shortcuts

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