0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 13:13:00 -05:00

Check for env vars

This commit is contained in:
dragongoose 2023-05-22 10:27:44 -04:00
parent 8baaa9a369
commit 547bbbd214
No known key found for this signature in database
GPG key ID: 50DB99B921579009

View file

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"os"
"safetwitch-backend/routes" "safetwitch-backend/routes"
"strings" "strings"
@ -32,6 +33,13 @@ func notFoundHandler(context *gin.Context) {
} }
func main() { 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 := gin.Default()
router.Use(ErrorHandler) router.Use(ErrorHandler)
routes.SetRoutes(router) routes.SetRoutes(router)