mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 10:13:01 +00:00
结构调整添加cmd
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user