From 547bbbd2140ef748af7011633cc29b8ea9b557c8 Mon Sep 17 00:00:00 2001 From: dragongoose Date: Mon, 22 May 2023 10:27:44 -0400 Subject: [PATCH] Check for env vars --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index 7c3896d..0131a00 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "os" "safetwitch-backend/routes" "strings" @@ -32,6 +33,13 @@ func notFoundHandler(context *gin.Context) { } func main() { + // check for env + env := os.Getenv("URL") + if env == "" { + fmt.Println("ENV Variable 'URL' is not present") + os.Exit(10) + } + router := gin.Default() router.Use(ErrorHandler) routes.SetRoutes(router)