config重构
This commit is contained in:
1 parent
0810383afc
commit
5f873914e0
14 files changed
+134
-208
No files matched your search
@@ -1,12 +1,10 @@
|
||||
package config
|
||||
|
||||
import "github.com/spf13/viper"
|
||||
|
||||
type Application struct {
|
||||
ReadTimeout int
|
||||
WriterTimeout int
|
||||
Host string
|
||||
Port string
|
||||
Port int64
|
||||
Name string
|
||||
JwtSecret string
|
||||
Mode string
|
||||
@@ -14,18 +12,4 @@ type Application struct {
|
||||
EnableDP bool
|
||||
}
|
||||
|
||||
func InitApplication(cfg *viper.Viper) *Application {
|
||||
return &Application{
|
||||
ReadTimeout: cfg.GetInt("readTimeout"),
|
||||
WriterTimeout: cfg.GetInt("writerTimeout"),
|
||||
Host: cfg.GetString("host"),
|
||||
Port: cfg.GetString("port"),
|
||||
Name: cfg.GetString("name"),
|
||||
JwtSecret: cfg.GetString("jwtSecret"),
|
||||
Mode: cfg.GetString("mode"),
|
||||
DemoMsg: cfg.GetString("demoMsg"),
|
||||
EnableDP: cfg.GetBool("enabledp"),
|
||||
}
|
||||
}
|
||||
|
||||
var ApplicationConfig = new(Application)
|
||||
Reference in new issue
Block a user