结构调整添加cmd

This commit is contained in:
zhangwenjian
2020-04-18 10:06:44 +08:00
parent f2829bfd98
commit a2f4c00246
72 changed files with 838 additions and 597 deletions
+25
View File
@@ -0,0 +1,25 @@
package config
import "github.com/spf13/viper"
type Database struct {
Dbtype string
Host string
Port int
Name string
Username string
Password string
}
func InitDatabase(cfg *viper.Viper) *Database {
return &Database{
Port: cfg.GetInt("port"),
Dbtype: cfg.GetString("dbType"),
Host: cfg.GetString("host"),
Name: cfg.GetString("name"),
Username: cfg.GetString("username"),
Password: cfg.GetString("password"),
}
}
var DatabaseConfig = new(Database)