From 14cf1284a100b896a1241738e26bc75d89b5e5bf Mon Sep 17 00:00:00 2001 From: dragongoose Date: Tue, 6 Jun 2023 13:37:08 -0400 Subject: [PATCH] Unix socket support --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 76f4390..d26d9e7 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,12 @@ func main() { router.Use(ErrorHandler) routes.SetRoutes(router) router.NoRoute(notFoundHandler) + log.Println("Safetwitch API running") - router.Run() + env = os.Getenv("PORT") + if strings.Contains(env, "/") { + router.RunUnix(env) + } else { + router.Run() + } }