mirror of
https://github.com/labring/sealos.git
synced 2026-09-21 13:51:32 +08:00
* feat: add devbox service * fix: fix the golangci-lint error Signed-off-by: cbluebird <crk2778355976@163.com> * chore: add devbox in service ci Signed-off-by: cbluebird <crk2778355976@163.com> --------- Signed-off-by: cbluebird <crk2778355976@163.com>
35 lines
805 B
Go
35 lines
805 B
Go
package main
|
|
|
|
import (
|
|
"log/slog"
|
|
"os"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
_ "github.com/joho/godotenv/autoload"
|
|
"github.com/labring/sealos/service/devbox/api"
|
|
"github.com/labring/sealos/service/devbox/middleware"
|
|
tag "github.com/labring/sealos/service/devbox/pkg/registry"
|
|
)
|
|
|
|
func main() {
|
|
user := os.Getenv("USER")
|
|
password := os.Getenv("PASSWORD")
|
|
tag.New(user, password)
|
|
if os.Getenv("GIN_MODE") != gin.DebugMode {
|
|
gin.SetMode(gin.ReleaseMode)
|
|
}
|
|
slog.SetLogLoggerLevel(slog.LevelInfo)
|
|
if os.Getenv("LOG_LEVEL") != "debug" {
|
|
slog.SetLogLoggerLevel(slog.LevelDebug)
|
|
}
|
|
|
|
r := gin.Default()
|
|
r.Use(gin.Recovery())
|
|
r.Use(middleware.CORS())
|
|
r.POST("/tag", middleware.TokenAuth, api.Tag)
|
|
if err := r.Run(":8092"); err != nil {
|
|
slog.Error("Failed to start server", "Error", err)
|
|
return
|
|
}
|
|
}
|