From 09e8ea66b75e8ac6e90942ab37814e9e1633afac Mon Sep 17 00:00:00 2001 From: Max Resnick Date: Fri, 30 Aug 2024 23:06:18 -0700 Subject: fix: handle basepath correctly --- internal/admin/service.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'internal/admin/service.go') diff --git a/internal/admin/service.go b/internal/admin/service.go index d60a072..f3d705c 100644 --- a/internal/admin/service.go +++ b/internal/admin/service.go @@ -27,11 +27,15 @@ func (s *Servicer) Reload() { slog.Error("refusing to reload config") return } - oldConfig := s.Conf + slog.Debug("config base after load", "path", tmpConfig.basePath) + // copy + oldConfig := *s.Conf + slog.Debug("config base before copy", "path", s.Conf.basePath) s.Conf = tmpConfig + slog.Debug("config base after copy", "path", s.Conf.basePath) if err := s.InitServer(); err != nil { slog.Error("couldn't init server with new config, falling back", err) - s.Conf = oldConfig + 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") @@ -66,6 +70,7 @@ func (s *Servicer) InitServer() error { } slog.Info("policy loaded") slog.Debug("init server", "repoDir", s.reposDir) + slog.Debug("init server", "repoDir", s.Conf.basePath) if err := s.Conf.ConfigureRepos(); err != nil { return fmt.Errorf("couldn't configure repos %w", err) } @@ -92,7 +97,6 @@ func NewService(modelPath, policyPath, serverConfigPath, reposDir string, mgmtRe } else if err != nil { return &Servicer{}, fmt.Errorf("Coudln't load server config. %w", err) } - conf.basePath = reposDir svc := &Servicer{ enf, conf, -- cgit v1.2.3