Some stubs and a possibly working config class.
parent
e42e6b7240
commit
20652578dc
|
@ -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
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package gorepost
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/arachnist/gorepost/config"
|
||||
"github.com/sorcix/irc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
}
|
Loading…
Reference in New Issue