Konfi-Castle-Kasino/pkg/config/config.go

49 lines
695 B
Go
Raw Normal View History

2019-09-01 20:59:51 +00:00
package config
import (
"github.com/go-ini/ini"
"log"
)
//Configuration Struct
type Configuration struct {
AdminPassword string
Interface string
DBFile string
Mode int
2019-09-04 20:11:13 +00:00
OpenWindows bool
2019-09-01 20:59:51 +00:00
}
var siteConf = &Configuration{}
func InitConfig() {
2019-09-02 20:19:49 +00:00
err := ini.MapTo(siteConf, "./config.ini")
2019-09-01 20:59:51 +00:00
if err != nil {
log.Fatal(err)
}
}
func GetConfig() *Configuration {
return siteConf
}
func GetMode() int {
return siteConf.Mode
}
func GetInterface() string {
return siteConf.Interface
}
func GetAdminPassword() string {
return siteConf.AdminPassword
}
func GetDBFile() string {
return siteConf.DBFile
}
2019-09-04 20:11:13 +00:00
func GetOpenWindows() bool {
return siteConf.OpenWindows
}