aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-06 00:42:11 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-06 00:42:26 +0800
commitf5ebe96649a30658bb8a8bee4cb2ac1b45823b28 (patch)
tree980c5fb915da731335baa30860d2e660bcffa407 /server.go
parentLMTP: Fix sed mistake (diff)
downloadforge-2abe0b881a112979f6cd56b87b395092ede17675.tar.gz
forge-2abe0b881a112979f6cd56b87b395092ede17675.tar.zst
forge-2abe0b881a112979f6cd56b87b395092ede17675.zip
Hooks, git2d: Simplify deployment logicv0.1.27
Diffstat (limited to 'server.go')
-rw-r--r--server.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/server.go b/server.go
index feab082..3e02586 100644
--- a/server.go
+++ b/server.go
@@ -13,10 +13,12 @@ import (
"net/http"
"os"
"os/exec"
+ "path/filepath"
"syscall"
"time"
"go.lindenii.runxiyu.org/forge/internal/database"
+ "go.lindenii.runxiyu.org/forge/internal/misc"
"go.lindenii.runxiyu.org/lindenii-common/cmap"
goSSH "golang.org/x/crypto/ssh"
)
@@ -64,18 +66,10 @@ func (s *Server) Setup() {
}
func (s *Server) Run() {
- if err := s.deployHooks(); err != nil {
- slog.Error("deploying hooks", "error", err)
- os.Exit(1)
- }
- if err := s.loadTemplates(); err != nil {
- slog.Error("loading templates", "error", err)
- os.Exit(1)
- }
- if err := s.deployGit2D(); err != nil {
- slog.Error("deploying git2d", "error", err)
- os.Exit(1)
- }
+ misc.NoneOrPanic(s.loadTemplates())
+ misc.NoneOrPanic(misc.DeployBinary(misc.FirstOrPanic(embeddedResourcesFS.Open("git2d/git2d")), s.config.Git.DaemonPath))
+ misc.NoneOrPanic(misc.DeployBinary(misc.FirstOrPanic(embeddedResourcesFS.Open("hookc/hookc")), filepath.Join(s.config.Hooks.Execs, "pre-receive")))
+ misc.NoneOrPanic(os.Chmod(filepath.Join(s.config.Hooks.Execs, "pre-receive"), 0o755))
// Launch Git2D
go func() {