mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
34 lines
482 B
Go
34 lines
482 B
Go
package irc
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
Name string
|
|
Listen string
|
|
Password string
|
|
Operators []OperatorConfig
|
|
Debug map[string]bool
|
|
}
|
|
|
|
type OperatorConfig struct {
|
|
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
|
|
}
|