From 1b4b976ec6c0e6f25cbdde7c3ee564e99a786e64 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 10 Aug 2024 00:53:27 +0900 Subject: feat: configure JWT secret --- worker/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'worker/main.go') diff --git a/worker/main.go b/worker/main.go index 8134a56..ac65305 100644 --- a/worker/main.go +++ b/worker/main.go @@ -3,6 +3,7 @@ package main import ( "log" "net/http" + "os" echojwt "github.com/labstack/echo-jwt/v4" "github.com/labstack/echo/v4" @@ -10,6 +11,11 @@ import ( ) func main() { + jwtSecret := os.Getenv("ALBATROSS_JWT_SECRET") + if jwtSecret == "" { + log.Fatal("ALBATROSS_JWT_SECRET is not set") + } + if err := prepareDirectories(); err != nil { log.Fatal(err) } @@ -20,7 +26,7 @@ func main() { e.Use(middleware.Recover()) e.Use(echojwt.WithConfig(echojwt.Config{ - SigningKey: []byte("TODO"), + SigningKey: []byte(jwtSecret), })) e.POST("/api/swiftc", handleSwiftCompile) -- cgit v1.2.3-70-g09d2