Add --disable-matrix flag for testing (fix #19)

This commit is contained in:
Noah 2024-03-15 15:57:32 -05:00
parent bce75062cf
commit 75ffee63c5

View File

@ -75,6 +75,7 @@ func main() {
// Parse arguments
parser := argparse.NewParser("lapisdeploy", "Easily deploy Lapis web applications through Gitea webhooks")
config_path := parser.String("c", "config", &argparse.Options{Required: false, Help: "Configuration file", Default: "./config.json"})
disable_matrix := parser.Flag("M", "disable-matrix", &argparse.Options{Required: false, Help: "Disable Matrix chat bot", Default: false})
if err := parser.Parse(os.Args); err != nil { // Parse arguments
fmt.Print(parser.Usage(err)) // Show usage if there's an error
return
@ -96,6 +97,10 @@ func main() {
log.Printf("Starting Lapis Deploy on port %d...", configuration.port)
startAllSites() // Start all the servers
if !*disable_matrix { // Only start Matrix bot if --disable-matrix isn't passed
go initMatrix() // Start Matrix stuff in a goroutine
} else {
log.Print("Matrix bot is disabled!")
}
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", configuration.port), nil)) // Start HTTP server
}