46 lines
588 B
Go
46 lines
588 B
Go
package config
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
)
|
|
|
|
var Cfg Config
|
|
|
|
type Config struct {
|
|
Server server
|
|
Database database
|
|
Mail mail
|
|
Settings settings
|
|
}
|
|
|
|
type server struct {
|
|
Debug bool
|
|
Host string
|
|
}
|
|
|
|
type database struct {
|
|
Host string
|
|
Database string
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
type mail struct {
|
|
Host string
|
|
Key string
|
|
}
|
|
|
|
type settings struct {
|
|
ExpiredTime int
|
|
UsernameMinLen int
|
|
UsernameMaxLen int
|
|
EmailMinLen int
|
|
EmailMaxLen int
|
|
PasswordMinLen int
|
|
PasswordMaxLen int
|
|
}
|
|
|
|
func LoadConfig() {
|
|
toml.DecodeFile("./config.toml", &Cfg)
|
|
}
|