3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00
ergo/irc/config.go

34 lines
482 B
Go
Raw Normal View History

2014-02-09 16:53:42 +01:00
package irc
import (
"encoding/json"
"os"
)
type Config struct {
2014-02-09 19:07:40 +01:00
Name string
Listen string
Password string
Operators []OperatorConfig
Debug map[string]bool
}
type OperatorConfig struct {
2014-02-09 16:53:42 +01:00
Name string
Password string
}
func LoadConfig() (config *Config, err error) {
config = &Config{}
file, err := os.Open("ergonomadic.json")
if err != nil {
return
}
defer file.Close()
decoder := json.NewDecoder(file)
err = decoder.Decode(config)
return
}