dashboard/config/config.go
2020-04-17 19:07:19 +01:00

85 lines
1.1 KiB
Go

package config
import (
"github.com/BurntSushi/toml"
"io/ioutil"
)
type (
Config struct {
Admins []string
Server Server
Oauth Oauth
MariaDB MariaDB
Bot Bot
Redis Redis
Cache Cache
}
Server struct {
Host string
BaseUrl string
MainSite string
Ratelimit Ratelimit
Session Session
}
Ratelimit struct {
Window int
Max int
}
Session struct {
Threads int
Secret string
}
Oauth struct {
Id int64
Secret string
RedirectUri string
}
MariaDB struct {
Host string
Username string
Password string
Database string
Threads int
}
Bot struct {
Token string
PremiumLookupProxyUrl string `toml:"premium-lookup-proxy-url"`
PremiumLookupProxyKey string `toml:"premium-lookup-proxy-key"`
ObjectStore string
}
Redis struct {
Host string
Port int
Password string
Threads int
}
Cache struct {
Uri string
}
)
var (
Conf Config
)
func LoadConfig() {
raw, err := ioutil.ReadFile("config.toml")
if err != nil {
panic(err)
}
_, err = toml.Decode(string(raw), &Conf)
if err != nil {
panic(err)
}
}