Documentation
¶
Overview ¶
Package settings owns persisted application settings and their HTTP surface.
Index ¶
- Constants
- func DefaultSettingsConfig() *models.Settings
- func RegisterSettings(api huma.API, settingsService *SettingsService, ...)
- type Dependencies
- type GetCategoriesOutput
- type GetPublicSettingsInput
- type GetPublicSettingsOutput
- type GetSettingsInput
- type GetSettingsOutput
- type Module
- type SearchSettingsInput
- type SearchSettingsOutput
- type SettingsHandler
- func (h *SettingsHandler) GetCategories(ctx context.Context, input *struct{}) (*GetCategoriesOutput, error)
- func (h *SettingsHandler) GetPublicSettings(ctx context.Context, input *GetPublicSettingsInput) (*GetPublicSettingsOutput, error)
- func (h *SettingsHandler) GetSettings(ctx context.Context, input *GetSettingsInput) (*GetSettingsOutput, error)
- func (h *SettingsHandler) Search(ctx context.Context, input *SearchSettingsInput) (*SearchSettingsOutput, error)
- func (h *SettingsHandler) UpdateSettings(ctx context.Context, input *UpdateSettingsInput) (*UpdateSettingsOutput, error)
- type SettingsService
- func (s *SettingsService) EnsureDefaultSettings(ctx context.Context) error
- func (s *SettingsService) EnsureEncryptionKey(ctx context.Context) (string, error)
- func (s *SettingsService) GetBoolSetting(ctx context.Context, key string, defaultValue bool) bool
- func (s *SettingsService) GetIntSetting(ctx context.Context, key string, defaultValue int) int
- func (s *SettingsService) GetSettingType(key string) string
- func (s *SettingsService) GetSettings(ctx context.Context) (*models.Settings, error)
- func (s *SettingsService) GetSettingsConfig() *models.Settings
- func (s *SettingsService) GetSettingsOrDefaults(ctx context.Context) *models.Settings
- func (s *SettingsService) GetStringSetting(ctx context.Context, key, defaultValue string) string
- func (s *SettingsService) IsEnvOverrideActive(key string) bool
- func (s *SettingsService) ListSettings(visibility models.SettingVisibility) []models.SettingVariable
- func (s *SettingsService) LoadDatabaseSettings(ctx context.Context) (err error)
- func (s *SettingsService) NormalizeBuildsDirectory(ctx context.Context) error
- func (s *SettingsService) NormalizeProjectsDirectory(ctx context.Context, projectsDirEnv string) error
- func (s *SettingsService) NotifySettingsChanges(ctx context.Context, keys ...string) error
- func (s *SettingsService) PersistEnvSettingsIfMissing(ctx context.Context) error
- func (s *SettingsService) PruneUnknownSettings(ctx context.Context) error
- func (s *SettingsService) SetBoolSetting(ctx context.Context, key string, value bool) error
- func (s *SettingsService) SetContainerAutoUpdateExclusionInternal(ctx context.Context, containerName string, excluded bool) error
- func (s *SettingsService) SetIntSetting(ctx context.Context, key string, value int) error
- func (s *SettingsService) SetStringSetting(ctx context.Context, key, value string) error
- func (s *SettingsService) SubscribeSettingsChanges(keys []string, callback func([]libarcane.SettingUpdate)) func()
- func (s *SettingsService) UpdateSetting(ctx context.Context, key, value string) error
- func (s *SettingsService) UpdateSettingValues(ctx context.Context, updates []libarcane.SettingUpdate) error
- func (s *SettingsService) UpdateSettings(ctx context.Context, updates settingstypes.Update) ([]models.SettingVariable, error)
- type UpdateSettingsInput
- type UpdateSettingsOutput
Constants ¶
const ( // DefaultArcaneToolsImage is the shared Arcane toolbox image used for helper commands. DefaultArcaneToolsImage = "ghcr.io/getarcaneapp/tools:latest" // DefaultTrivyImage is the default vulnerability scanner image setting. DefaultTrivyImage = DefaultArcaneToolsImage )
Variables ¶
This section is empty.
Functions ¶
func DefaultSettingsConfig ¶
DefaultSettingsConfig returns the canonical default settings model used by Arcane.
func RegisterSettings ¶
func RegisterSettings(api huma.API, settingsService *SettingsService, settingsSearchService *search.SettingsSearchService, proxyRemoteJSON handlerutil.RemoteJSONProxy, cfg *config.Config)
RegisterSettings registers settings management routes using Huma.
Types ¶
type Dependencies ¶
type Dependencies struct {
Search *search.SettingsSearchService
ProxyRemoteJSON handlerutil.RemoteJSONProxy
Config *config.Config
}
Dependencies are the handler-side collaborators for the settings domain.
type GetCategoriesOutput ¶
type GetPublicSettingsInput ¶
type GetPublicSettingsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
type GetPublicSettingsOutput ¶
type GetPublicSettingsOutput struct {
Body []settingstypes.PublicSetting
}
type GetSettingsInput ¶
type GetSettingsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
type GetSettingsOutput ¶
type GetSettingsOutput struct {
Body []settingstypes.PublicSetting
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module joins the settings service with its route dependencies.
func New ¶
func New(service *SettingsService, deps Dependencies) *Module
New builds the settings domain around its initialized actor-backed service.
func (*Module) RegisterRoutes ¶
RegisterRoutes mounts settings endpoints for runtime and schema discovery.
func (*Module) Service ¶
func (m *Module) Service() *SettingsService
Service exposes settings operations to collaborating domains.
type SearchSettingsInput ¶
type SearchSettingsInput struct {
Body searchtypes.Request `doc:"Search query"`
}
type SearchSettingsOutput ¶
type SearchSettingsOutput struct {
Body searchtypes.Response
}
type SettingsHandler ¶
type SettingsHandler struct {
// contains filtered or unexported fields
}
SettingsHandler provides Huma-based settings management endpoints.
func (*SettingsHandler) GetCategories ¶
func (h *SettingsHandler) GetCategories(ctx context.Context, input *struct{}) (*GetCategoriesOutput, error)
GetCategories returns all available settings categories.
func (*SettingsHandler) GetPublicSettings ¶
func (h *SettingsHandler) GetPublicSettings(ctx context.Context, input *GetPublicSettingsInput) (*GetPublicSettingsOutput, error)
GetPublicSettings returns public settings for an environment.
func (*SettingsHandler) GetSettings ¶
func (h *SettingsHandler) GetSettings(ctx context.Context, input *GetSettingsInput) (*GetSettingsOutput, error)
GetSettings returns all settings for an environment.
func (*SettingsHandler) Search ¶
func (h *SettingsHandler) Search(ctx context.Context, input *SearchSettingsInput) (*SearchSettingsOutput, error)
Search searches settings by query.
func (*SettingsHandler) UpdateSettings ¶
func (h *SettingsHandler) UpdateSettings(ctx context.Context, input *UpdateSettingsInput) (*UpdateSettingsOutput, error)
UpdateSettings updates settings for an environment.
type SettingsService ¶
type SettingsService struct {
// contains filtered or unexported fields
}
func NewSettingsService ¶
func (*SettingsService) EnsureDefaultSettings ¶
func (s *SettingsService) EnsureDefaultSettings(ctx context.Context) error
func (*SettingsService) EnsureEncryptionKey ¶
func (s *SettingsService) EnsureEncryptionKey(ctx context.Context) (string, error)
func (*SettingsService) GetBoolSetting ¶
func (*SettingsService) GetIntSetting ¶
func (*SettingsService) GetSettingType ¶
func (s *SettingsService) GetSettingType(key string) string
GetSettingType returns the type from the setting metadata
func (*SettingsService) GetSettings ¶
GetSettings returns the effective (env-override-applied) settings snapshot. The snapshot is shared across callers and must be treated as read-only; mutation flows go through UpdateSettings, which works on an explicit clone.
func (*SettingsService) GetSettingsConfig ¶
func (s *SettingsService) GetSettingsConfig() *models.Settings
func (*SettingsService) GetSettingsOrDefaults ¶
func (s *SettingsService) GetSettingsOrDefaults(ctx context.Context) *models.Settings
GetSettingsOrDefaults is a convenience for hot paths that need a snapshot but cannot meaningfully recover from a settings load failure. It logs any error and guarantees a non-nil *Settings (defaults: a zero-valued struct, which the SettingVariable helpers like utils.BoolOrDefault treat as "use the caller's default").
func (*SettingsService) GetStringSetting ¶
func (s *SettingsService) GetStringSetting(ctx context.Context, key, defaultValue string) string
func (*SettingsService) IsEnvOverrideActive ¶
func (s *SettingsService) IsEnvOverrideActive(key string) bool
IsEnvOverrideActive reports whether an environment override currently controls the setting. and its corresponding environment variable is currently set to a non-empty value.
func (*SettingsService) ListSettings ¶
func (s *SettingsService) ListSettings(visibility models.SettingVisibility) []models.SettingVariable
func (*SettingsService) LoadDatabaseSettings ¶
func (s *SettingsService) LoadDatabaseSettings(ctx context.Context) (err error)
func (*SettingsService) NormalizeBuildsDirectory ¶
func (s *SettingsService) NormalizeBuildsDirectory(ctx context.Context) error
func (*SettingsService) NormalizeProjectsDirectory ¶
func (s *SettingsService) NormalizeProjectsDirectory(ctx context.Context, projectsDirEnv string) error
func (*SettingsService) NotifySettingsChanges ¶
func (s *SettingsService) NotifySettingsChanges(ctx context.Context, keys ...string) error
NotifySettingsChanges publishes current values for keys through the settings actor. It is used when another settings-table workflow performs persistence.
func (*SettingsService) PersistEnvSettingsIfMissing ¶
func (s *SettingsService) PersistEnvSettingsIfMissing(ctx context.Context) error
func (*SettingsService) PruneUnknownSettings ¶
func (s *SettingsService) PruneUnknownSettings(ctx context.Context) error
func (*SettingsService) SetBoolSetting ¶
func (*SettingsService) SetContainerAutoUpdateExclusionInternal ¶
func (s *SettingsService) SetContainerAutoUpdateExclusionInternal(ctx context.Context, containerName string, excluded bool) error
SetContainerAutoUpdateExclusionInternal adds or removes a container name from the autoUpdateExcludedContainers setting. When excluded is true the container is added to the list; when false it is removed.
func (*SettingsService) SetIntSetting ¶
func (*SettingsService) SetStringSetting ¶
func (s *SettingsService) SetStringSetting(ctx context.Context, key, value string) error
func (*SettingsService) SubscribeSettingsChanges ¶
func (s *SettingsService) SubscribeSettingsChanges(keys []string, callback func([]libarcane.SettingUpdate)) func()
SubscribeSettingsChanges invokes callback once when any subscribed key is present in a successful update. The callback receives only matching values. Callbacks run serially on the settings-effects actor, outside the write actor.
func (*SettingsService) UpdateSetting ¶
func (s *SettingsService) UpdateSetting(ctx context.Context, key, value string) error
func (*SettingsService) UpdateSettingValues ¶
func (s *SettingsService) UpdateSettingValues(ctx context.Context, updates []libarcane.SettingUpdate) error
UpdateSettingValues persists a group of internal setting values atomically and publishes the refreshed snapshot before returning.
func (*SettingsService) UpdateSettings ¶
func (s *SettingsService) UpdateSettings(ctx context.Context, updates settingstypes.Update) ([]models.SettingVariable, error)
UpdateSettings publishes the refreshed snapshot before returning. Each subscriber's effects remain ordered and may finish after this method returns.
type UpdateSettingsInput ¶
type UpdateSettingsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body settingstypes.Update `doc:"Settings update data"`
}
type UpdateSettingsOutput ¶
type UpdateSettingsOutput struct {
Body base.ApiResponse[[]settingstypes.SettingDto]
}