aboutsummaryrefslogtreecommitdiff
path: root/telegabber.go
blob: 8c098e12036061995e668142380b66cdcc4b500e (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
package main

import (
	"dev.narayana.im/narayana/telegabber/config"
	"dev.narayana.im/narayana/telegabber/xmpp"

	log "github.com/sirupsen/logrus"
)

// YAML config, compatible with the format of Zhabogram 2.0.0
const configPath string = "config.yml"

// JSON schema (not for editing by a user)
const schemaPath string = "./config_schema.json"

func main() {
	config, err := config.ReadConfig(configPath, schemaPath)
	if err != nil {
		log.Fatal(err)
	}

	SetLogrusLevel(config.XMPP.Loglevel)

	cm, err := xmpp.NewComponent(config.XMPP, config.Telegram)
	if err != nil {
		log.Fatal(err)
	}

	// reconnect automatically
	log.Fatal(cm.Run())
}