feat: add settings.Updater interface to ServiceDeps
This commit is contained in:
parent
2c89ce4d42
commit
62c25a7b3a
@ -50,6 +50,7 @@ type ServiceDeps struct {
|
|||||||
CoreServiceBindings CoreServiceBindings
|
CoreServiceBindings CoreServiceBindings
|
||||||
ReviewSubmitter ReviewSubmitter
|
ReviewSubmitter ReviewSubmitter
|
||||||
BadgeRefresher BadgeRefresher
|
BadgeRefresher BadgeRefresher
|
||||||
|
SettingsUpdater settings.Updater
|
||||||
|
|
||||||
// Extension points — typed as narrow interfaces where possible
|
// Extension points — typed as narrow interfaces where possible
|
||||||
JobRunner JobRunner
|
JobRunner JobRunner
|
||||||
|
|||||||
@ -8,6 +8,11 @@ type Settings interface {
|
|||||||
GetPluginSettings(ctx context.Context, pluginName string) (map[string]any, error)
|
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.
|
// 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 {
|
func GetStringOr(m map[string]any, key, defaultVal string) string {
|
||||||
if v, ok := m[key].(string); ok {
|
if v, ok := m[key].(string); ok {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user