Some stubs and a possibly working config class.

configurable-file-paths
Robert Gerus 2015-10-15 16:50:32 +02:00
parent e42e6b7240
commit 20652578dc
2 changed files with 44 additions and 0 deletions

31
config/config.go Normal file
View File

@ -0,0 +1,31 @@
package config
import (
"encoding/json"
"io/ioutil"
)
type Config struct {
Nick string
Host string
Networks []string
Servers map[string] string
Channels map[string] string
Passwords map[string] string
}
func ReadConfig(path string) (Config, error) {
var config Config
data, err := ioutil.ReadFile(path)
if err != nil {
return config, err
}
err = json.Unmarshal(data, &config)
if err != nil {
return config, err
}
return config, nil
}

13
gorepost.go Normal file
View File

@ -0,0 +1,13 @@
package gorepost
import (
"log"
"os"
"time"
"github.com/arachnist/gorepost/config"
"github.com/sorcix/irc"
)
func main() {
}