Browse Source

add flag for godotenv

pull/1/head
Stephanie Gredell 7 months ago
parent
commit
8bc52fd5f0
  1. 10
      cmd/systemdesigngame/main.go

10
cmd/systemdesigngame/main.go

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package main
import (
"flag"
"github.com/joho/godotenv"
"html/template"
"net/http"
@ -11,11 +12,16 @@ import ( @@ -11,11 +12,16 @@ import (
)
func main() {
err := godotenv.Load()
if err != nil {
devMode := flag.Bool("dev", false, "load .env (local dev)")
flag.Parse()
if *devMode {
if err := godotenv.Load(); err != nil {
panic("failed to load .env")
}
}
// set up JWT secret used for authentication
auth.JwtSecret = []byte(os.Getenv("JWT_SECRET"))
tmpl := template.Must(template.ParseGlob("static/*.html"))

Loading…
Cancel
Save