feat: add settings.Updater interface to ServiceDeps

This commit is contained in:
Alex Dunmow 2026-05-02 11:03:40 +08:00
parent 2c89ce4d42
commit 62c25a7b3a
2 changed files with 6 additions and 0 deletions

View File

@ -50,6 +50,7 @@ type ServiceDeps struct {
CoreServiceBindings CoreServiceBindings
ReviewSubmitter ReviewSubmitter
BadgeRefresher BadgeRefresher
SettingsUpdater settings.Updater
// Extension points — typed as narrow interfaces where possible
JobRunner JobRunner

View File

@ -8,6 +8,11 @@ type Settings interface {
GetPluginSettings(ctx context.Context, pluginName string) (map[string]any, error)
}
// Updater allows plugins to modify site settings.
type Updater interface {
UpdateSiteSetting(ctx context.Context, key string, value any) error
}
// GetStringOr returns a string value from a map, or defaultVal if not found/wrong type.
func GetStringOr(m map[string]any, key, defaultVal string) string {
if v, ok := m[key].(string); ok {