2021-06-20 15:16:06 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-07-11 15:17:03 +02:00
|
|
|
"log"
|
2021-06-20 15:39:54 +02:00
|
|
|
"os"
|
2021-06-20 15:16:06 +02:00
|
|
|
"path"
|
|
|
|
|
2021-06-29 08:07:28 +02:00
|
|
|
"gitea-sonarqube-pr-bot/internal/settings"
|
2021-07-11 15:17:03 +02:00
|
|
|
handler "gitea-sonarqube-pr-bot/internal/webhook_handler"
|
|
|
|
"github.com/urfave/cli/v2"
|
2021-06-20 15:16:06 +02:00
|
|
|
)
|
|
|
|
|
2021-06-29 08:07:28 +02:00
|
|
|
func getConfigLocation() string {
|
2021-06-20 15:16:06 +02:00
|
|
|
configPath := path.Join("config")
|
2021-06-20 15:39:54 +02:00
|
|
|
if customConfigPath, ok := os.LookupEnv("PRBOT_CONFIG_PATH"); ok {
|
|
|
|
configPath = customConfigPath
|
|
|
|
}
|
|
|
|
|
|
|
|
return configPath
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2021-06-29 08:07:28 +02:00
|
|
|
settings.Load(getConfigLocation())
|
2021-07-11 15:17:03 +02:00
|
|
|
|
|
|
|
app := &cli.App{
|
2021-10-03 17:57:22 +02:00
|
|
|
Name: "gitea-sonarqube-pr-bot",
|
|
|
|
Usage: "Improve your experience with SonarQube and Gitea",
|
2021-07-11 15:17:03 +02:00
|
|
|
Description: `By default, gitea-sonarqube-pr-bot will start running the webserver if no arguments are passed.`,
|
2021-10-03 17:57:22 +02:00
|
|
|
Action: handler.Serve,
|
2021-07-11 15:17:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
err := app.Run(os.Args)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2021-06-20 15:16:06 +02:00
|
|
|
}
|