mirror of
https://github.com/ergochat/ergo.git
synced 2025-01-03 16:42:38 +01:00
28 lines
384 B
Go
28 lines
384 B
Go
|
package irc
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
type Config struct {
|
||
|
Name string
|
||
|
Listen string
|
||
|
Password string
|
||
|
Debug map[string]bool
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|