config

package
v1.1.46 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const RpcByGRpc = "grpc"
View Source
const RpcByHttp = "http"

rpc 请求方式

View Source
const RpcRegByEtcd = "etcd"
View Source
const RpcRegByNone = "none"

rpc注册方式

Variables

This section is empty.

Functions

func DefiConfigPath added in v1.1.46

func DefiConfigPath(s ...string) string

DefiConfigPath 默认的config path获取

Types

type AuthConfig added in v1.1.25

type AuthConfig struct {
	SecretKey   string `yaml:"SecretKey"`
	AuthExpired int64  `yaml:"AuthExpired"`
}

AuthConfig 授权登录相关

type DBConfig

type DBConfig struct {
	DbConn     string `yaml:"DbConn"` //数据库类型,如mysql
	DbHost     string `yaml:"DbHost"`
	DbPort     string `yaml:"DbPort"`
	DbUser     string `yaml:"DbUser"`
	DbPassword string `yaml:"DbPassword"`
	DbName     string `yaml:"DbName"`

	MaxIdleConns int    `default:"0" yaml:"MaxIdleConns"`    //预留并发链接数
	MaxOpenConns int    `default:"0" yaml:"MaxOpenConns"`    //最大支持链接
	MaxLifetime  int    `default:"0" yaml:"ConnMaxLifetime"` //每个链接最大生存时间
	MaxIdleTime  int    `default:"0" yaml:"ConnMaxIdleTime"` //每个链接最大空闲时间
	MaxConcatLen string `default:"" yaml:"MaxConcatLen"`
}

func (DBConfig) DSNForMysql added in v1.1.21

func (c DBConfig) DSNForMysql(extends ...map[string]string) string

func (DBConfig) DSNForPgSql added in v1.1.21

func (c DBConfig) DSNForPgSql(extends ...map[string]string) string

type EmailConfig added in v1.1.29

type EmailConfig struct {
	SmtpName     string `yaml:"SmtpName"`     //smtp 发送名称
	SmtpHost     string `yaml:"SmtpHost"`     //smtp服务host
	SmtpPort     int    `yaml:"SmtpPort"`     //smtp服务端口
	SmtpUserName string `yaml:"SmtpUserName"` //smtp用户名
	SmtpPassword string `yaml:"SmtpPassword"` //smtp密码
}

邮箱配置

type LogConfig added in v1.1.29

type LogConfig struct {

	//日志路径
	LPath string `default:"./runtime/logs/app.log" yaml:"LPath"`

	//是否包含文件路径
	// 0: 不包含,1:短文件名,2:完整路径
	LFilepath int `default:"0" yaml:"LFilepath"`

	//日志等级,与LogLevel一致
	LLevel string `default:"debug" yaml:"LLoglevel"`

	//对应 runtime.Caller
	LCallerSkip int `default:"0" yaml:"LCallerSkip"`
	// contains filtered or unexported fields
}

日志配置

func DefiLogConfig added in v1.1.46

func DefiLogConfig() *LogConfig

DefiLogConfig 默认日志配置

type RpcClientConfig

type RpcClientConfig struct {
	RpcServer    string `yaml:"RpcServer"`    //rpc访问地址
	RpcTimeout   int64  `yaml:"RpcTimeout"`   //rpc访问超时时间
	RpcDisWay    string `yaml:"RpcDisWay"`    //服务发现方式:none/etcd
	RpcDisServer string `yaml:"RpcDisServer"` //服务发现server地址
}

rpc客户端配置

type RpcServerConfig added in v1.1.20

type RpcServerConfig struct {
	RpcLisAddr     string `yaml:"RpcLisAddr"`     //grpc启动端口,如 ":4001"
	RpcRegWay      string `yaml:"RpcRegWay"`      //服务注册方式:none/etcd
	RpcRegServer   string `yaml:"RpcRegServer"`   //服务注册服务端地址,如etcd地址
	RpcRequestAddr string `yaml:"RpcRequestAddr"` //服务访问地址
}

服务端grpc配置

Jump to

Keyboard shortcuts

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