33 lines
407 B
Go
33 lines
407 B
Go
package config
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
_ "github.com/go-sql-driver/mysql"
|
|
)
|
|
|
|
var conf Config
|
|
|
|
type Config struct {
|
|
Server server
|
|
Database database
|
|
}
|
|
|
|
type database struct {
|
|
Host string
|
|
Database string
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
type server struct {
|
|
Host string
|
|
}
|
|
|
|
func LoadConfig() {
|
|
toml.DecodeFile("./config.toml", &conf)
|
|
}
|
|
|
|
func GetConfig() Config {
|
|
return conf
|
|
}
|