config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ENV_DEBUG      = "debug"
	ENV_PRODUCTION = "production"
)

Functions

This section is empty.

Types

type BrokerConfig added in v0.0.3

type BrokerConfig struct {
	Name string
	Host string //连接地址
}

type Config

type Config struct {
	Environment string

	//ServerName string //服务名称--4-11改。通过app启动设置
	ServerPort string //服务端口
	//ApiPort    string //api端口
	Timezome string //时区设置

	Mysql      *MysqlConfig
	Redis      *RedisConfig
	MongoDb    *MongoDBConfig
	FileServer *FileServerConfig
	Log        *LogConfig
	Broker     *BrokerConfig
	Registry   *Registry
}

公共配置模板

func LoadConfig

func LoadConfig(config_file ...string) (*Config, error)

LoadConfig config

func ParseConfig

func ParseConfig(f string) (*Config, error)

ParseConfig 解析

type FileServerConfig

type FileServerConfig struct {
	PublicStaticUrl  string //公共文件URL
	PrivateStaticUrl string //私有文件URL
}

文件服务器配置

type LogConfig

type LogConfig struct {
	Target     string //日志输出目标。一般是console或者file
	LogFile    string //日志输出文件
	MaxSize    int    //日志文件最大尺寸
	MaxBackups int    //最大备份数
	MaxAge     int    //最大停留
	Level      int
}

type MongoDBConfig

type MongoDBConfig struct {
	Host     string //地址
	Port     string //端口
	User     string //账户
	Password string //
	Monitor  bool   //监控
	DbName   string //库名
}

Mongo

type MysqlConfig

type MysqlConfig struct {
	Name        string //数据库名字
	Host        string
	User        string
	Port        string
	Password    string
	Debug       bool //是否开启调试
	MaxIdle     int
	MaxOpen     int
	TablePrefix string
}

Mysql

type RedisConfig

type RedisConfig struct {
	Addr string //连接地址
	Auth string //认证
	Num  int    //库的数字
}

redis

type Registry added in v0.0.3

type Registry struct {
	Environment string
	Org         string
	Name        string
	Addr        string //连接地址
	Auth        string //认证
	Num         int    //库的数字
}

Jump to

Keyboard shortcuts

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