mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 02:04:09 +00:00
20 lines
294 B
Go
20 lines
294 B
Go
package config
|
|
|
|
import "github.com/spf13/viper"
|
|
|
|
type Database struct {
|
|
Driver string
|
|
Source string
|
|
}
|
|
|
|
func InitDatabase(cfg *viper.Viper) *Database {
|
|
|
|
db := &Database{
|
|
Driver: cfg.GetString("driver"),
|
|
Source: cfg.GetString("source"),
|
|
}
|
|
return db
|
|
}
|
|
|
|
var DatabaseConfig = new(Database)
|