forked from External/ergo
configure server with json
This commit is contained in:
parent
55d3d6e946
commit
281558072a
4 changed files with 51 additions and 12 deletions
27
irc/config.go
Normal file
27
irc/config.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue