summaryrefslogtreecommitdiffstats
path: root/matterbridge.go
blob: db0ebf00086a588b00a8b5a3ef774ac9124b5ffc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main

import (
	"flag"
	"fmt"
	"github.com/42wim/matterbridge/bridge"
	log "github.com/Sirupsen/logrus"
)

var Version = "0.4.2"

func init() {
	log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
}

func main() {
	flagConfig := flag.String("conf", "matterbridge.conf", "config file")
	flagDebug := flag.Bool("debug", false, "enable debug")
	flagVersion := flag.Bool("version", false, "show version")
	flagPlus := flag.Bool("plus", false, "running using API instead of webhooks")
	flag.Parse()
	if *flagVersion {
		fmt.Println("Version:", Version)
		return
	}
	flag.Parse()
	if *flagDebug {
		log.Info("enabling debug")
		log.SetLevel(log.DebugLevel)
	}
	fmt.Println("running version", Version)
	if *flagPlus {
		bridge.NewBridge("matterbot", bridge.NewConfig(*flagConfig), "")
	} else {
		bridge.NewBridge("matterbot", bridge.NewConfig(*flagConfig), "legacy")
	}
	select {}
}