From 75ffee63c5a0397280df69390331ad4e15e5c560 Mon Sep 17 00:00:00 2001 From: Noah Date: Fri, 15 Mar 2024 15:57:32 -0500 Subject: [PATCH] Add --disable-matrix flag for testing (fix #19) --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e078b68..7a8784a 100644 --- a/main.go +++ b/main.go @@ -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 @@ -95,7 +96,11 @@ func main() { }) log.Printf("Starting Lapis Deploy on port %d...", configuration.port) - startAllSites() // Start all the servers - go initMatrix() // Start Matrix stuff in a goroutine + 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 }