settings

package
v2.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: BSD-3-Clause Imports: 39 Imported by: 0

Documentation

Overview

Package settings owns persisted application settings and their HTTP surface.

Index

Constants

View Source
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

func DefaultSettingsConfig() *models.Settings

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 GetCategoriesOutput struct {
	Body []category.Category
}

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

func (m *Module) RegisterRoutes(api huma.API)

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

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

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 NewSettingsService(ctx context.Context, db *database.DB, writes, effects *actors.Executor) (*SettingsService, error)

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 (s *SettingsService) GetBoolSetting(ctx context.Context, key string, defaultValue bool) bool

func (*SettingsService) GetIntSetting

func (s *SettingsService) GetIntSetting(ctx context.Context, key string, defaultValue int) int

func (*SettingsService) GetSettingType

func (s *SettingsService) GetSettingType(key string) string

GetSettingType returns the type from the setting metadata

func (*SettingsService) GetSettings

func (s *SettingsService) GetSettings(ctx context.Context) (*models.Settings, error)

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 (s *SettingsService) SetBoolSetting(ctx context.Context, key string, value bool) error

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 (s *SettingsService) SetIntSetting(ctx context.Context, key string, value int) error

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]
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL