Skip to content

Commit 0adb590

Browse files
committed
feat(admin): reload config before returning settings in GET handler
1 parent 47ad646 commit 0adb590

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

backend/internal/presentation/api/admin/settings_handler.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
// configService defines the interface for configuration management
1616
type configService interface {
17+
Reload(ctx context.Context) error
1718
GetConfig() *models.MutableConfig
1819
UpdateSection(ctx context.Context, category models.ConfigCategory, input json.RawMessage, updatedBy string) error
1920
TestSMTP(ctx context.Context, cfg models.SMTPConfig) error
@@ -87,6 +88,10 @@ type StorageResponse struct {
8788

8889
// HandleGetSettings handles GET /api/v1/admin/settings
8990
func (h *SettingsHandler) HandleGetSettings(w http.ResponseWriter, r *http.Request) {
91+
if err := h.configService.Reload(r.Context()); err != nil {
92+
shared.WriteInternalError(w)
93+
return
94+
}
9095
cfg := h.configService.GetConfig()
9196

9297
// Build response with masked secrets

backend/internal/presentation/api/router.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type webhookService interface {
104104

105105
// configService defines configuration management operations
106106
type configService interface {
107+
Reload(ctx context.Context) error
107108
GetConfig() *models.MutableConfig
108109
UpdateSection(ctx context.Context, category models.ConfigCategory, input json.RawMessage, updatedBy string) error
109110
TestSMTP(ctx context.Context, cfg models.SMTPConfig) error

0 commit comments

Comments
 (0)