aboutsummaryrefslogtreecommitdiffhomepage
path: root/worker/swift/main.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-05 20:34:02 +0900
committernsfisis <nsfisis@gmail.com>2025-09-05 20:52:59 +0900
commitdd1c68425120fca008a3b10991c865ea586c7002 (patch)
tree13784e4e2923d7a51a63ba148c89907ef73cce6f /worker/swift/main.go
parentc7941d027be068f6e563a17e882232580fe15334 (diff)
downloadiosdc-japan-2025-albatross-dd1c68425120fca008a3b10991c865ea586c7002.tar.gz
iosdc-japan-2025-albatross-dd1c68425120fca008a3b10991c865ea586c7002.tar.zst
iosdc-japan-2025-albatross-dd1c68425120fca008a3b10991c865ea586c7002.zip
feat(worker): add swift worker
Diffstat (limited to 'worker/swift/main.go')
-rw-r--r--worker/swift/main.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/worker/swift/main.go b/worker/swift/main.go
new file mode 100644
index 0000000..ac65305
--- /dev/null
+++ b/worker/swift/main.go
@@ -0,0 +1,39 @@
+package main
+
+import (
+ "log"
+ "net/http"
+ "os"
+
+ echojwt "github.com/labstack/echo-jwt/v4"
+ "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v4/middleware"
+)
+
+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)
+ }
+
+ e := echo.New()
+
+ e.Use(middleware.Logger())
+ e.Use(middleware.Recover())
+
+ e.Use(echojwt.WithConfig(echojwt.Config{
+ SigningKey: []byte(jwtSecret),
+ }))
+
+ e.POST("/api/swiftc", handleSwiftCompile)
+ e.POST("/api/wasmc", handleWasmCompile)
+ e.POST("/api/testrun", handleTestRun)
+
+ if err := e.Start(":80"); err != http.ErrServerClosed {
+ log.Fatal(err)
+ }
+}