summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-09-27 15:33:26 +0600
committerunwox <me@unwox.com>2024-09-27 15:33:26 +0600
commitadae08e3dfca081da1a0bc70f3d242ea2b79efb3 (patch)
tree6fe178c2892364140a0664423c8a3fafb354cbbe
parent22dd9e85fcd899a4521ca2358e2310fc04998cbf (diff)
allow running one-shot scripts without serving HTTP
-rw-r--r--main.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.go b/main.go
index 677de94..09ebd01 100644
--- a/main.go
+++ b/main.go
@@ -379,8 +379,11 @@ func main() {
}
}()
- log.Printf("luna is running at %s...", *lAddr)
- log.Fatal(http.ListenAndServe(*lAddr, mux))
+ if len(routes) > 0 {
+ log.Printf("luna is running at %s...", *lAddr)
+ log.Fatal(http.ListenAndServe(*lAddr, mux))
+ }
+ log.Printf("no HTTP-routes were registered, exiting...")
}
func printUsage() {