|
|
package config
|
|
|
|
|
|
import "github.com/gogf/gf/v2/database/gdb"
|
|
|
|
|
|
// 使用 mapstructure 标签可以指定 confgi 的 key 名
|
|
|
|
|
|
type (
|
|
|
AppConfig struct {
|
|
|
Server Server `json:"server" mapstructure:"server"`
|
|
|
Databases Databases `json:"databases" mapstructure:"databases"`
|
|
|
MainControllerClient MainControllerClient `json:"mainControllerClient" mapstructure:"mainControllerClient"`
|
|
|
Togocdn Togocdn `json:"togocdn" mapstructure:"togocdn"`
|
|
|
Logger Logger `json:"logger" mapstructure:"logger"`
|
|
|
LicenseConf LicenseConf `json:"licenseConf" mapstructure:"licenseConf"`
|
|
|
Zap Zap `json:"zap" mapstructure:"zap"`
|
|
|
Tty Tty `json:"tty" mapstructure:"tty"`
|
|
|
DeviceInfo DeviceInfo `json:"deviceInfo" mapstructure:"deviceInfo"`
|
|
|
Firefox Firefox `json:"firefox" mapstructure:"firefox"`
|
|
|
MessageInterval int `json:"MessageInterval" mapstructure:"MessageInterval"`
|
|
|
IotServer IotServer `json:"iotServer" mapstructure:"iotServer"`
|
|
|
RabbitMq RabbitMq `json:"rabbitMq" mapstructure:"rabbitMq"`
|
|
|
LiKong LiKong `json:"liKong" mapstructure:"li-kong"`
|
|
|
HuYi HuYi `json:"huYi" mapstructure:"hu-yi"`
|
|
|
AliSms AliSms `json:"aliSms" mapstructure:"ali-sms"`
|
|
|
Gdb gdb.Config `json:"gdb" mapstructure:"gdb"`
|
|
|
}
|
|
|
)
|
|
|
|
|
|
type (
|
|
|
Server struct {
|
|
|
Port int `json:"port" mapstructure:"port"`
|
|
|
Static string `json:"static" mapstructure:"static"`
|
|
|
IsLocal bool `json:"isLocal" mapstructure:"is-local"`
|
|
|
}
|
|
|
|
|
|
Databases struct {
|
|
|
Mode string `json:"mode" mapstructure:"mode"`
|
|
|
Nodes []DatabasesNode `json:"nodes" mapstructure:"nodes"`
|
|
|
}
|
|
|
DatabasesNode struct {
|
|
|
DbType string `json:"DbType" mapstructure:"DbType"`
|
|
|
IsMaster bool `json:"IsMaster" mapstructure:"IsMaster"`
|
|
|
Dsn string `json:"Dsn" mapstructure:"Dsn"`
|
|
|
SqlMaxIdleConns int `json:"sqlMaxIdleConns" mapstructure:"sqlMaxIdleConns"`
|
|
|
SqlMaxOpenConns int `json:"sqlMaxOpenConns" mapstructure:"sqlMaxOpenConns"`
|
|
|
SqlLogLevel int `json:"sqlLogLevel" mapstructure:"sqlLogLevel"`
|
|
|
}
|
|
|
|
|
|
MainControllerClient struct {
|
|
|
ServerHost string `json:"server_host" mapstructure:"server_host"`
|
|
|
SecretKey string `json:"secret_key" mapstructure:"secret_key"`
|
|
|
}
|
|
|
|
|
|
Togocdn struct {
|
|
|
Client struct {
|
|
|
Priority int `json:"Priority" mapstructure:"Priority"`
|
|
|
ModuleName string `json:"ModuleName" mapstructure:"ModuleName"`
|
|
|
ServerUrls []string `json:"ServerUrls" mapstructure:"ServerUrls"`
|
|
|
} `json:"client" mapstructure:"client"`
|
|
|
}
|
|
|
|
|
|
Logger struct {
|
|
|
Path string `json:"path" mapstructure:"path"`
|
|
|
File string `json:"file" mapstructure:"file"`
|
|
|
Prefix string `json:"prefix" mapstructure:"prefix"`
|
|
|
Level string `json:"level" mapstructure:"level"`
|
|
|
TimeFormat string `json:"timeFormat" mapstructure:"timeFormat"`
|
|
|
CtxKeys []interface{} `json:"ctxKeys" mapstructure:"ctxKeys"`
|
|
|
Header bool `json:"header" mapstructure:"header"`
|
|
|
Stdout bool `json:"stdout" mapstructure:"stdout"`
|
|
|
RotateSize int `json:"rotateSize" mapstructure:"rotateSize"`
|
|
|
RotateExpire string `json:"rotateExpire" mapstructure:"rotateExpire"`
|
|
|
RotateBackupLimit int `json:"rotateBackupLimit" mapstructure:"rotateBackupLimit"`
|
|
|
RotateBackupExpire string `json:"rotateBackupExpire" mapstructure:"rotateBackupExpire"`
|
|
|
RotateBackupCompress int `json:"rotateBackupCompress" mapstructure:"rotateBackupCompress"`
|
|
|
RotateCheckInterval string `json:"rotateCheckInterval" mapstructure:"rotateCheckInterval"`
|
|
|
StdoutColorDisabled bool `json:"stdoutColorDisabled" mapstructure:"stdoutColorDisabled"`
|
|
|
WriterColorEnable bool `json:"writerColorEnable" mapstructure:"writerColorEnable"`
|
|
|
}
|
|
|
|
|
|
LicenseConf struct {
|
|
|
LicenseServerUrl string `json:"LicenseServerUrl" mapstructure:"LicenseServerUrl"`
|
|
|
LicenseKey string `json:"LicenseKey" mapstructure:"LicenseKey"`
|
|
|
}
|
|
|
|
|
|
Tty struct {
|
|
|
SerialPortAddress string `json:"serialPortAddress" mapstructure:"serialPortAddress"`
|
|
|
BaudRate int `json:"baudRate" mapstructure:"baudRate"`
|
|
|
}
|
|
|
|
|
|
DeviceInfo struct {
|
|
|
DeviceId string `json:"deviceId" mapstructure:"deviceId"`
|
|
|
Version string `json:"version" mapstructure:"version"`
|
|
|
MeterAddr string `json:"meterAddr" mapstructure:"meterAddr"`
|
|
|
}
|
|
|
|
|
|
Firefox struct {
|
|
|
DebPkgPath string `json:"DebPkgPath" mapstructure:"DebPkgPath"`
|
|
|
DebPkgName string `json:"DebPkgName" mapstructure:"DebPkgName"`
|
|
|
InstallShellPath string `json:"InstallShellPath" mapstructure:"InstallShellPath"`
|
|
|
}
|
|
|
|
|
|
IotServer struct {
|
|
|
ServerUrl string `json:"serverUrl" mapstructure:"serverUrl"`
|
|
|
Port string `json:"port" mapstructure:"port"`
|
|
|
}
|
|
|
|
|
|
RabbitMq struct {
|
|
|
Server string `json:"server" mapstructure:"server"`
|
|
|
Port int `json:"port" mapstructure:"port"`
|
|
|
Username string `json:"username" mapstructure:"username"`
|
|
|
Password string `json:"password" mapstructure:"password"`
|
|
|
}
|
|
|
|
|
|
// LiKong 接口客户端
|
|
|
LiKong struct {
|
|
|
BaseURL string `json:"baseURL" mapstructure:"base-url"`
|
|
|
TenantID string `json:"tenantID" mapstructure:"tenant-id"`
|
|
|
ClientID string `json:"clientID" mapstructure:"client-id"`
|
|
|
ClientSecret string `json:"clientSecret" mapstructure:"client-secret"`
|
|
|
Username string `json:"username" mapstructure:"username"`
|
|
|
Password string `json:"password" mapstructure:"password"`
|
|
|
ApiPrefix string `json:"api-prefix" mapstructure:"api-prefix"`
|
|
|
}
|
|
|
HuYi struct {
|
|
|
BaseURL string `json:"baseURL" mapstructure:"base-url"`
|
|
|
AppId string `json:"appID" mapstructure:"app-id"`
|
|
|
AppKey string `json:"appKey" mapstructure:"app-key"`
|
|
|
TemplateId string `json:"templateId" mapstructure:"template-id"`
|
|
|
}
|
|
|
AliSms struct {
|
|
|
// AccessKeyID RAM账号AccessKey ID
|
|
|
AccessKeyID string `json:"accessKeyID" mapstructure:"access-key-id"`
|
|
|
|
|
|
// AccessKeySecret RAM账号AccessKey Secret
|
|
|
AccessKeySecret string `json:"accessKeySecret" mapstructure:"access-key-secret"`
|
|
|
|
|
|
// SignName 短信签名(审核通过的名称)
|
|
|
SignName string `json:"signName" mapstructure:"sign-name"`
|
|
|
|
|
|
// WarnTemplateId 告警短信模板ID
|
|
|
WarnTemplateId string `json:"warnTemplateId" mapstructure:"warn-template-id"`
|
|
|
|
|
|
// InfoTemplateId 信息短信模板ID
|
|
|
InfoTemplateId string `json:"infoTemplateId" mapstructure:"info-template-id"`
|
|
|
|
|
|
// Endpoint 短信服务接入地址(默认:dysmsapi.aliyuncs.com)
|
|
|
Endpoint string `json:"endpoint" mapstructure:"endpoint"`
|
|
|
}
|
|
|
)
|