123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package config
- import "encoding/json"
- type LogConfig struct {
- Path string `json:"path"`
- Level string `json:"level"`
- MaxSize int `json:"max_size"`
- MaxBackups int `json:"max_backups"`
- MaxAge int `json:"max_age"`
- Stacktrace bool `json:"stacktrace"`
- }
- type MysqlConfig struct {
- User string `json:"user"`
- Password string `json:"password"`
- Addr string `json:"addr"`
- DB string `json:"db"`
- Charset string `json:"charset"`
- MaxIdle int `json:"max_idle"`
- MaxConn int `json:"max_conn"`
- LogMode bool `json:"log_mode"`
- }
- type RedisConfig struct {
- Addrs []string `json:"addrs"`
- Password string `json:"password"`
- DB int `json:"db"`
- PoolSize int `json:"pool_size"`
- MinIdleConns int `json:"min_idle_conns"`
- MaxRetries int `json:"max_retries"`
- Cluster bool `json:"cluster"`
- }
- type ElasticConfig struct {
- Addrs []string `json:"addrs"`
- Sniff bool `json:"sniff"`
- }
- type ThirdPartNode struct {
- Host string `json:"host"`
- AppKey string `json:"app_key"`
- AppSecret string `json:"app_secret"`
- }
- type ThirdPartConfig struct {
- PartName ThirdPartNode `json:"part_name"`
- }
- type RPCNode struct {
- ServiceName string `json:"service_name"`
- ServicePort int `json:"service_port"`
- ServiceIp string `json:"service_ip"`
- MysqlDb string `json:"mysql_db"`
- RedisDb int `json:"redis_db"`
- LogLevel string `json:"log_level"`
- LogStacktrace bool `json:"log_stacktrace"`
- Host string `json:"host"`
- }
- type KeepaliveConfig struct {
- ClientTime int `json:"client_time"`
- ClientTimeout int `json:"client_timeout"`
- ServerTime int `json:"server_time"`
- ServerTimeout int `json:"server_timeout"`
- ServerMiniTime int `json:"server_mini_time"`
- }
- type RPCConfig struct {
- Prefix string `json:"prefix"`
- Keepalive KeepaliveConfig `json:"keepalive"`
- ADMManagement RPCNode `json:"adm_management"`
- }
- type EtcdConfig struct {
- Addrs []string `json:"addrs"`
- }
- type RabbitmqConfig struct {
- Addr string `json:"addr"`
- Username string `json:"username"`
- Passwrod string `json:"passwrod"`
- Vhost string `json:"vhost"`
- ExchangeName string `json:"exchange_name"`
- QueueName string `json:"queue_name"`
- RouteBindKey string `json:"route_bind_key"`
- ConsumerCount json.Number `json:"consumer_count"`
- }
- type Configure struct {
- // 基础配置
- K8s bool `json:"k8s"`
- RunMode string `json:"run_mode"`
- Log LogConfig `json:"log"`
- // 按需配置
- Mysql MysqlConfig `json:"mysql"`
- Redis RedisConfig `json:"redis"`
- Elastic ElasticConfig `json:"elastic"`
- ThirdPart ThirdPartConfig `json:"third_part"`
- // 所要启用的服务
- Rpc RPCConfig `json:"rpc"`
- // etcd
- Etcd EtcdConfig `json:"etcd"`
- // oss
- Oss OssConfig `json:"oss"`
- OdsRabbitmq RabbitmqConfig `json:"ods_rabbitmq"`
- }
- type OssConfig struct {
- AccessKey string `json:"access_key"`
- AccessSecret string `json:"access_secret"`
- Bucket string `json:"bucket"`
- EndPoint string `json:"end_point"`
- DefaultBrandImage string `json:"default_brand_image"`
- BrandImage string `json:"brand_image"`
- DefaultSeriesImage string `json:"default_series_image"`
- SeriesImage string `json:"series_image"`
- DownLoadBucket string `json:"down_load_bucket"`
- }
|