Documentation
¶
Overview ¶
Package config config struct definition
Index ¶
- func CreateLogger(filename string) (log.Logger, error)
- func CreateLoggers(fpath string, names []string) ([]log.Logger, error)
- func CreateLogrusLogger(filename string) (*logrus.Logger, error)
- type ApplicationConfig
- type ApplicationEntity
- type ClickhouseConfig
- type ConsumerMq
- type GlobalConfiguration
- type MonitorSweeperConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateLoggers ¶
CreateLoggers 批量创建Logger
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct {
Global struct {
Logpath string
Debug bool
Loggers struct {
AppLogger log.Logger
SQLLogger log.Logger
DomainLogger log.Logger
}
// 应用名
App string
// 用户管理模式
User struct {
// 用户默认收藏
DefaultFavorites string
// 账号类型(支持:Userpassword)
AccountType string
// Userpassword 登录使用的会话 JWT
JWTSecret string
JWTHeadKey string
JWTExpireMinutes int
// 用户头像地址
UserPhotoURL string
// 用户登录跳转页面
LoginURL string
// 黑名单
Blacklist []string
}
// 缓存模块是否开启
Cache struct {
InstanceOpen bool
}
}
Resource struct {
// 业务数据库
MetaDB config.AccessPoint `json:"metadb" yaml:"metadb"`
ClickhouseDB ClickhouseConfig `yaml:"clickhouse_db"`
// 系统基础信息指标队列
SysInfoMq ConsumerMq `yaml:"sys_info_mq"`
InstanceCache config.AccessPoint `yaml:"redis_cache"`
Lock config.AccessPoint `json:"lock" yaml:"redis_lock"`
}
Dependence struct {
// ETL-msg
Metrics config.AccessPoint `yaml:"metrics"`
}
Application struct {
Gateway struct {
MaxConnection int
}
Stream struct {
MaxConnection int
BatchStoreSize int `json:"batch_store_size" yaml:"batch_store_size"`
SysInfo config.CronPoint `yaml:"sys_info"`
MonitorSweeper MonitorSweeperConfig `yaml:"monitor_sweeper"`
}
}
}
ApplicationConfig application config
func DefaultApplicationConfig ¶
func DefaultApplicationConfig() ApplicationConfig
DefaultApplicationConfig new default config
func (*ApplicationConfig) LoadEntity ¶
func (app *ApplicationConfig) LoadEntity() (*ApplicationEntity, error)
LoadEntity ....
func (*ApplicationConfig) OpenClickhouse ¶
func (app *ApplicationConfig) OpenClickhouse(conf *ClickhouseConfig) (driver.Conn, error)
OpenClickhouse ...
type ApplicationEntity ¶
type ApplicationEntity struct {
Logger struct {
WebLogger log.Logger
RobotLogger log.Logger
SQLLogger log.Logger
GeneralLogger log.Logger
StreamLogger log.Logger
}
Global struct {
Debug bool
TemplatesPath string
ConfigFilePath string
LogsPath string
}
Resource struct {
MetaDB *database.DBClient
Lock lock.Lock
CkClient driver.Conn
// 系统基础信息指标队列
SysInfoMq mq.MessageQueue
}
}
ApplicationEntity application entity
type ClickhouseConfig ¶
type ClickhouseConfig struct {
config.AccessPoint `yaml:",inline"`
MaxOpenConn int `yaml:"max_open_conn"`
MaxIdleConn int `yaml:"max_idle_conn"`
Distributed bool `yaml:"distributed"`
Debug bool `yaml:"debug"`
MaxExecutionTime int `yaml:"max_execution_time"`
}
ClickhouseConfig clickhouse配置
type ConsumerMq ¶
type ConsumerMq struct {
config.AccessPoint `yaml:",inline"`
ConsumerNum int `yaml:"consumer_num"`
}
ConsumerMq 采集数据mq配置
type GlobalConfiguration ¶
type GlobalConfiguration struct {
GatewayYaml trpc.TrpcYaml `json:"trpc.gateway" type:"string"`
Application trpc.TrpcYaml `json:"application" type:"yaml"`
}
GlobalConfiguration 全局配置
func LoadGlobalConfigurationFromLocalfile ¶
func LoadGlobalConfigurationFromLocalfile(appfile string) (*GlobalConfiguration, error)
LoadGlobalConfigurationFromLocalfile load from local file
func (*GlobalConfiguration) LoadApplication ¶
func (gc *GlobalConfiguration) LoadApplication() (*ApplicationConfig, error)
LoadApplication loadconfig from string
Click to show internal directories.
Click to hide internal directories.