49 lines
695 B
Go
49 lines
695 B
Go
package config
|
|
|
|
import (
|
|
"github.com/go-ini/ini"
|
|
"log"
|
|
)
|
|
|
|
//Configuration Struct
|
|
type Configuration struct {
|
|
AdminPassword string
|
|
Interface string
|
|
DBFile string
|
|
Mode int
|
|
OpenWindows bool
|
|
}
|
|
|
|
var siteConf = &Configuration{}
|
|
|
|
func InitConfig() {
|
|
err := ini.MapTo(siteConf, "./config.ini")
|
|
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
|
|
}
|
|
|
|
func GetOpenWindows() bool {
|
|
return siteConf.OpenWindows
|
|
}
|