2019-04-13 12:31:28 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/go-ini/ini"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// import "net/http"
|
|
|
|
|
|
|
|
var cfg *ini.File
|
|
|
|
var err error
|
2019-04-14 20:43:16 +02:00
|
|
|
var bot *GiteaBot
|
2019-04-13 12:31:28 +02:00
|
|
|
|
|
|
|
func init() {
|
2019-04-14 20:43:16 +02:00
|
|
|
//Lonad config
|
2019-04-13 12:31:28 +02:00
|
|
|
cfg, err = ini.Load("config.ini")
|
|
|
|
if err != nil {
|
|
|
|
fmt.Printf("Fail to read file: %v", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
2019-04-14 20:43:16 +02:00
|
|
|
matrixUser := cfg.Section("matrix").Key("matrix_user").String()
|
|
|
|
matrixPass := cfg.Section("matrix").Key("matrix_pass").String()
|
|
|
|
// botDB := cfg.Section("bot").Key("").String()
|
2019-04-13 12:31:28 +02:00
|
|
|
|
2019-04-14 20:43:16 +02:00
|
|
|
fmt.Println("Creating Bot")
|
|
|
|
bot, err = NewGiteaBot(matrixUser, matrixPass)
|
2019-04-13 12:31:28 +02:00
|
|
|
|
2019-04-14 20:43:16 +02:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
2019-04-13 12:31:28 +02:00
|
|
|
|
2019-04-14 20:43:16 +02:00
|
|
|
func main() {
|
2019-04-13 12:31:28 +02:00
|
|
|
|
|
|
|
fmt.Println("Setting up POST-listener")
|
|
|
|
setupListener()
|
|
|
|
}
|