From adae08e3dfca081da1a0bc70f3d242ea2b79efb3 Mon Sep 17 00:00:00 2001 From: unwox Date: Fri, 27 Sep 2024 15:33:26 +0600 Subject: allow running one-shot scripts without serving HTTP --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main.go') 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() { -- cgit v1.2.3