|
| 1 | +// Code generated by https://github.com/go-dev-frame/sponge; DO NOT EDIT. |
| 2 | + |
| 3 | +package config |
| 4 | + |
| 5 | +import ( |
| 6 | + "github.com/go-dev-frame/sponge/pkg/conf" |
| 7 | +) |
| 8 | + |
| 9 | +var config *Config |
| 10 | + |
| 11 | +func Init(configFile string, fs ...func()) error { |
| 12 | + config = &Config{} |
| 13 | + return conf.Parse(configFile, config, fs...) |
| 14 | +} |
| 15 | + |
| 16 | +func Show(hiddenFields ...string) string { |
| 17 | + return conf.Show(config, hiddenFields...) |
| 18 | +} |
| 19 | + |
| 20 | +func Get() *Config { |
| 21 | + if config == nil { |
| 22 | + panic("config is nil, please call config.Init() first") |
| 23 | + } |
| 24 | + return config |
| 25 | +} |
| 26 | + |
| 27 | +func Set(conf *Config) { |
| 28 | + config = conf |
| 29 | +} |
| 30 | + |
| 31 | +type Config struct { |
| 32 | + App App `yaml:"app" json:"app"` |
| 33 | + Database Database `yaml:"database" json:"database"` |
| 34 | + HTTP HTTP `yaml:"http" json:"http"` |
| 35 | + Jaeger Jaeger `yaml:"jaeger" json:"jaeger"` |
| 36 | + JWT JWT `yaml:"jwt" json:"jwt"` |
| 37 | + Logger Logger `yaml:"logger" json:"logger"` |
| 38 | + Rails Rails `yaml:"rails" json:"rails"` |
| 39 | + Redis Redis `yaml:"redis" json:"redis"` |
| 40 | +} |
| 41 | + |
| 42 | +type TLS struct { |
| 43 | + AcmeDirectory string `yaml:"acmeDirectory" json:"acmeDirectory"` |
| 44 | + Domains []string `yaml:"domains" json:"domains"` |
| 45 | + Eab Eab `yaml:"eab" json:"eab"` |
| 46 | + StoragePath string `yaml:"storagePath" json:"storagePath"` |
| 47 | +} |
| 48 | + |
| 49 | +type Jaeger struct { |
| 50 | + AgentHost string `yaml:"agentHost" json:"agentHost"` |
| 51 | + AgentPort int `yaml:"agentPort" json:"agentPort"` |
| 52 | +} |
| 53 | + |
| 54 | +type App struct { |
| 55 | + CacheType string `yaml:"cacheType" json:"cacheType"` |
| 56 | + EnableCircuitBreaker bool `yaml:"enableCircuitBreaker" json:"enableCircuitBreaker"` |
| 57 | + EnableHTTPProfile bool `yaml:"enableHTTPProfile" json:"enableHTTPProfile"` |
| 58 | + EnableLimit bool `yaml:"enableLimit" json:"enableLimit"` |
| 59 | + EnableMetrics bool `yaml:"enableMetrics" json:"enableMetrics"` |
| 60 | + EnableStat bool `yaml:"enableStat" json:"enableStat"` |
| 61 | + EnableTrace bool `yaml:"enableTrace" json:"enableTrace"` |
| 62 | + Env string `yaml:"env" json:"env"` |
| 63 | + Host string `yaml:"host" json:"host"` |
| 64 | + Name string `yaml:"name" json:"name"` |
| 65 | + TracingSamplingRate float64 `yaml:"tracingSamplingRate" json:"tracingSamplingRate"` |
| 66 | + Version string `yaml:"version" json:"version"` |
| 67 | +} |
| 68 | + |
| 69 | +type Mysql struct { |
| 70 | + ConnMaxLifetime int `yaml:"connMaxLifetime" json:"connMaxLifetime"` |
| 71 | + Dsn string `yaml:"dsn" json:"dsn"` |
| 72 | + EnableLog bool `yaml:"enableLog" json:"enableLog"` |
| 73 | + MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"` |
| 74 | + MaxOpenConns int `yaml:"maxOpenConns" json:"maxOpenConns"` |
| 75 | +} |
| 76 | + |
| 77 | +type Rails struct { |
| 78 | + CookieName string `yaml:"cookieName" json:"cookieName"` |
| 79 | + SecretKeyBase string `yaml:"secretKeyBase" json:"secretKeyBase"` |
| 80 | + UserID int64 `yaml:"userID" json:"userID"` |
| 81 | +} |
| 82 | + |
| 83 | +type Redis struct { |
| 84 | + DialTimeout int `yaml:"dialTimeout" json:"dialTimeout"` |
| 85 | + Dsn string `yaml:"dsn" json:"dsn"` |
| 86 | + ReadTimeout int `yaml:"readTimeout" json:"readTimeout"` |
| 87 | + WriteTimeout int `yaml:"writeTimeout" json:"writeTimeout"` |
| 88 | +} |
| 89 | + |
| 90 | +type Database struct { |
| 91 | + Driver string `yaml:"driver" json:"driver"` |
| 92 | + Mysql Mysql `yaml:"mysql" json:"mysql"` |
| 93 | +} |
| 94 | + |
| 95 | +type JWT struct { |
| 96 | + Expire int `yaml:"expire" json:"expire"` |
| 97 | + SigningKey string `yaml:"signingKey" json:"signingKey"` |
| 98 | +} |
| 99 | + |
| 100 | +type Logger struct { |
| 101 | + Format string `yaml:"format" json:"format"` |
| 102 | + IsSave bool `yaml:"isSave" json:"isSave"` |
| 103 | + Level string `yaml:"level" json:"level"` |
| 104 | +} |
| 105 | + |
| 106 | +type HTTP struct { |
| 107 | + HTTPSPort int `yaml:"httpsPort" json:"httpsPort"` |
| 108 | + IdleTimeout int `yaml:"idleTimeout" json:"idleTimeout"` |
| 109 | + Port int `yaml:"port" json:"port"` |
| 110 | + ReadTimeout int `yaml:"readTimeout" json:"readTimeout"` |
| 111 | + Timeout int `yaml:"timeout" json:"timeout"` |
| 112 | + TLS TLS `yaml:"tls" json:"tls"` |
| 113 | + WriteTimeout int `yaml:"writeTimeout" json:"writeTimeout"` |
| 114 | +} |
| 115 | + |
| 116 | +type Eab struct { |
| 117 | + HmacKey string `yaml:"hmacKey" json:"hmacKey"` |
| 118 | + Kid string `yaml:"kid" json:"kid"` |
| 119 | +} |
0 commit comments