63 lines
897 B
Go
63 lines
897 B
Go
package config
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
)
|
|
|
|
var Cfg Config
|
|
|
|
type Config struct {
|
|
Server server
|
|
Database database
|
|
Mail mail
|
|
RabbitMq rabbitmq
|
|
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 rabbitmq struct {
|
|
Host string
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
type settings struct {
|
|
DefaultLanguageId int
|
|
Expires settingsExpires `toml:"expires"`
|
|
Lengths settingsLengths `toml:"lengths"`
|
|
}
|
|
|
|
type settingsExpires struct {
|
|
UserSession int
|
|
UserActivation int
|
|
}
|
|
|
|
type settingsLengths struct {
|
|
UsernameMinLen int
|
|
UsernameMaxLen int
|
|
EmailMinLen int
|
|
EmailMaxLen int
|
|
PasswordMinLen int
|
|
PasswordMaxLen int
|
|
}
|
|
|
|
func LoadConfig() {
|
|
toml.DecodeFile("./config.toml", &Cfg)
|
|
}
|