feat: import Sea vHost single-server testing release

This commit is contained in:
canglan committed 2026-10-30 08:39:10 +08:00
commit 248badd33e
441 files changed
+63221

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package httpapi
import (
"net/http"
"sea-vhost/internal/hosting"
"strconv"
)
func (s *Server) siteStartup(w http.ResponseWriter, r *http.Request) {
id, _ := projectID(r)
site, _ := strconv.ParseUint(r.PathValue("siteID"), 10, 64)
u := currentUser(r)
if r.Method == "GET" {
v, e := s.projects.Startup(r.Context(), u, id, site)
if e != nil {
writeError(w, 404, "无法读取启动配置")
return
}
writeJSON(w, 200, map[string]any{"startup": v})
return
}
var v hosting.Startup
if decodeJSON(r, &v) != nil {
writeError(w, 400, "启动设置格式无效")
return
}
if e := s.projects.SetStartup(r.Context(), u, id, site, v); e != nil {
writeError(w, 422, e.Error())
return
}
s.store.Log(r.Context(), u.TenantID, u.ID, "update", "site", strconv.FormatUint(site, 10), requestClientIP(r), true, "更新网站环境变量与启动配置")
w.WriteHeader(204)
}