Skip to content

Commit

Permalink
Add version string
Browse files Browse the repository at this point in the history
  • Loading branch information
42wim committed Mar 26, 2016
1 parent 686aa97 commit 8e49c6d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
var logger log.Logger = log.NullLogger
var flagRestrict, flagDefaultTeam, flagDefaultServer *string
var flagInsecure *bool
var Version = "0.4-dev"

func main() {
flagDebug := flag.Bool("debug", false, "enable debug logging")
Expand All @@ -23,13 +24,18 @@ func main() {
flagDefaultTeam = flag.String("mmteam", "", "specify default mattermost team")
flagDefaultServer = flag.String("mmserver", "", "specify default mattermost server/instance")
flagInsecure = flag.Bool("mminsecure", false, "use http connection to mattermost")
flagVersion := flag.Bool("version", false, "show version")
flag.Parse()

logger = golog.New(os.Stderr, log.Info)
if *flagDebug {
logger.Info("enabling debug")
logger = golog.New(os.Stderr, log.Debug)
}
if *flagVersion {
fmt.Println("Version:", Version)
return
}

irckit.SetLogger(logger)
socket, err := net.Listen("tcp", fmt.Sprintf("%s:%d", *flagBindInterface, *flagBindPort))
Expand All @@ -53,7 +59,7 @@ func start(socket net.Listener) {
cfg := &irckit.MmCfg{AllowedServers: strings.Fields(*flagRestrict),
DefaultTeam: *flagDefaultTeam, DefaultServer: *flagDefaultServer,
Insecure: *flagInsecure}
newsrv := irckit.ServerConfig{Name: "matterircd", Version: "0.3"}.Server()
newsrv := irckit.ServerConfig{Name: "matterircd", Version: Version}.Server()
logger.Infof("New connection: %s", conn.RemoteAddr())
err = newsrv.Connect(irckit.NewUserMM(conn, newsrv, cfg))
if err != nil {
Expand Down

0 comments on commit 8e49c6d

Please sign in to comment.