aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/service.go
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2024-05-04 10:24:48 -0700
committerMax Resnick <max@ofmax.li>2024-05-20 21:33:57 -0700
commitb8584fec70bd6810fa2392deadc69595b3e94cfa (patch)
tree2c2b17e06f780ad7d6ba46a0189f4faf45629fcb /internal/admin/service.go
parent11fe503d5ea17fa3ddc4ce2308ea82b6edc7763e (diff)
downloadgo-git-server-b8584fec70bd6810fa2392deadc69595b3e94cfa.tar.gz
feat: refactor of repo management
Diffstat (limited to '')
-rw-r--r--internal/admin/service.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/admin/service.go b/internal/admin/service.go
index bcf42f9..c1082d5 100644
--- a/internal/admin/service.go
+++ b/internal/admin/service.go
@@ -26,8 +26,17 @@ func (s *Servicer) Reload() {
slog.Error("refusing to reload config")
return
}
+ oldConfig := s.Conf
s.Conf = tmpConfig
- _ = s.InitServer()
+ if err := s.InitServer(); err != nil {
+ slog.Error("couldn't init server with new config, falling back", err)
+ s.Conf = oldConfig
+ if err := s.InitServer(); err != nil {
+ slog.Error("couldn't init server with old config, falling back", err)
+ panic("new and old config couldn't init server, no available config to run")
+ }
+ slog.Error("server has fallen back to old config but it lives in memory only, in fragile state")
+ }
}
// InitServer initialize a git server and configure