aboutsummaryrefslogtreecommitdiffhomepage
path: root/worker
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-10 00:53:27 +0900
committernsfisis <nsfisis@gmail.com>2024-08-10 00:53:27 +0900
commit1b4b976ec6c0e6f25cbdde7c3ee564e99a786e64 (patch)
tree771fe342b68a5f8906259e395e6e8444a9a8616c /worker
parent01fafac46390e540f4d8766d53177a69da7e64ae (diff)
downloadiosdc-japan-2024-albatross-1b4b976ec6c0e6f25cbdde7c3ee564e99a786e64.tar.gz
iosdc-japan-2024-albatross-1b4b976ec6c0e6f25cbdde7c3ee564e99a786e64.tar.zst
iosdc-japan-2024-albatross-1b4b976ec6c0e6f25cbdde7c3ee564e99a786e64.zip
feat: configure JWT secret
Diffstat (limited to 'worker')
-rw-r--r--worker/main.go8
1 files changed, 7 insertions, 1 deletions
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)