38 lines
597 B
Go
38 lines
597 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding/gob"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
|
||
|
"git.trj.tw/golang/mtgbot/modules/config"
|
||
|
"git.trj.tw/golang/mtgbot/modules/options"
|
||
|
"git.trj.tw/golang/mtgbot/router/routes"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
options.RegFlag()
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
opts := options.GetOpts()
|
||
|
|
||
|
// Load config file
|
||
|
err := config.LoadConfig(opts.Config)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
conf := config.GetConf()
|
||
|
|
||
|
// register session object types
|
||
|
regTypes()
|
||
|
|
||
|
engine := routes.NewEngine()
|
||
|
routes.SetRoutes(engine)
|
||
|
engine.Run(fmt.Sprintf(":%d", conf.Port))
|
||
|
}
|
||
|
|
||
|
func regTypes() {
|
||
|
gob.Register(map[string]interface{}{})
|
||
|
}
|