3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00
ergo/ergonomadic.go

44 lines
890 B
Go
Raw Normal View History

2014-02-08 22:18:11 +01:00
package main
import (
2014-02-24 07:21:39 +01:00
"flag"
"fmt"
2014-02-08 22:18:11 +01:00
"github.com/jlatt/ergonomadic/irc"
2014-02-09 16:53:42 +01:00
"log"
2014-02-08 22:18:11 +01:00
)
func main() {
2014-02-24 07:21:39 +01:00
conf := flag.String("conf", "ergonomadic.json", "ergonomadic config file")
initdb := flag.Bool("initdb", false, "initialize database")
2014-02-24 07:21:39 +01:00
passwd := flag.String("genpasswd", "", "bcrypt a password")
flag.Parse()
if *passwd != "" {
encoded, err := irc.GenerateEncodedPassword(*passwd)
if err != nil {
log.Fatal(err)
}
fmt.Println(encoded)
2014-02-24 07:21:39 +01:00
return
}
config, err := irc.LoadConfig(*conf)
2014-02-09 16:53:42 +01:00
if err != nil {
log.Fatal(err)
}
if *initdb {
irc.InitDB(config.Database())
log.Println("database initialized: " + config.Database())
2014-02-09 16:53:42 +01:00
return
}
// TODO move to data structures
2014-02-09 16:53:42 +01:00
irc.DEBUG_NET = config.Debug["net"]
irc.DEBUG_CLIENT = config.Debug["client"]
irc.DEBUG_CHANNEL = config.Debug["channel"]
irc.DEBUG_SERVER = config.Debug["server"]
2014-02-24 04:13:45 +01:00
irc.NewServer(config).Run()
2014-02-08 22:18:11 +01:00
}