Documentation
¶
Overview ¶
Package systemsetting implements the system configuration subdomain of the platform module. Runtime subsystem re-initialization, restart and the mutable configuration snapshot are reached through injected callbacks.
Index ¶
- type AuditWriter
- type Deps
- type MultiplierFunc
- type PlatformTransactor
- type Service
- func (s *Service) GetCurrencyConfig(ctx context.Context) (*dto.CurrencyConfig, error)
- func (s *Service) GetInviteConfig(ctx context.Context) (*dto.InviteConfig, error)
- func (s *Service) GetNodeConfig(ctx context.Context) (*dto.NodeConfig, error)
- func (s *Service) GetNodeMultiplier(ctx context.Context) (*dto.GetNodeMultiplierResponse, error)
- func (s *Service) GetPrivacyPolicyConfig(ctx context.Context) (*dto.PrivacyPolicyConfig, error)
- func (s *Service) GetRegisterConfig(ctx context.Context) (*dto.RegisterConfig, error)
- func (s *Service) GetSiteConfig(ctx context.Context) (*dto.SiteConfig, error)
- func (s *Service) GetSubscribeConfig(ctx context.Context) (*dto.SubscribeConfig, error)
- func (s *Service) GetTosConfig(ctx context.Context) (*dto.TosConfig, error)
- func (s *Service) GetVerifyCodeConfig(ctx context.Context) (*dto.VerifyCodeConfig, error)
- func (s *Service) GetVerifyConfig(ctx context.Context) (*dto.VerifyConfig, error)
- func (s *Service) PreViewNodeMultiplier(_ context.Context) (*dto.PreViewNodeMultiplierResponse, error)
- func (s *Service) SetNodeMultiplier(ctx context.Context, req *dto.SetNodeMultiplierRequest) error
- func (s *Service) SettingTelegramBot(ctx context.Context) error
- func (s *Service) UpdateCurrencyConfig(ctx context.Context, req *dto.CurrencyConfig) error
- func (s *Service) UpdateInviteConfig(ctx context.Context, req *dto.InviteConfig) error
- func (s *Service) UpdateNodeConfig(ctx context.Context, req *dto.NodeConfig) error
- func (s *Service) UpdatePrivacyPolicyConfig(ctx context.Context, req *dto.PrivacyPolicyConfig) error
- func (s *Service) UpdateRegisterConfig(ctx context.Context, req *dto.RegisterConfig) error
- func (s *Service) UpdateSiteConfig(ctx context.Context, req *dto.SiteConfig) error
- func (s *Service) UpdateSubscribeConfig(ctx context.Context, req *dto.SubscribeConfig) error
- func (s *Service) UpdateTosConfig(ctx context.Context, req *dto.TosConfig) error
- func (s *Service) UpdateVerifyCodeConfig(ctx context.Context, req *dto.VerifyCodeConfig) error
- func (s *Service) UpdateVerifyConfig(ctx context.Context, req *dto.VerifyConfig) error
- type SettingsStore
- type SettingsTransactor
- type SettingsWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditWriter ¶ added in v1.21.0
AuditWriter records the administrator's change next to the settings it changed, in the same transaction.
type Deps ¶
type Deps struct {
System kernel.SystemRepo
// Store runs the writes of each update in one transaction.
Store SettingsTransactor
// Reinitialize re-runs a subsystem's initialization after its
// configuration changed, reporting a failure.
Reinitialize func(subsystem string) error
// Restart restarts the transport server (subscribe path changes).
Restart func() error
// SubscribePath reads the currently active subscribe path.
SubscribePath func() string
// Multiplier evaluates the current node traffic multiplier.
Multiplier func(at time.Time) float32
}
Deps declares the subdomain's dependencies; the module facade forwards them from the composition root.
type MultiplierFunc ¶
MultiplierFunc evaluates the current node traffic multiplier.
type PlatformTransactor ¶
type PlatformTransactor interface {
InPlatformTx(ctx context.Context, fn func(kernel.PlatformStore) error) error
}
PlatformTransactor mirrors the store's platform-scoped transaction.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reads and updates the system settings for the platform facade.
func NewService ¶
NewService builds the system settings service.
func (*Service) GetCurrencyConfig ¶
GetCurrencyConfig returns the stored currency settings, the exchange-rate provider's access key masked.
func (*Service) GetInviteConfig ¶
GetInviteConfig returns the stored invitation settings.
func (*Service) GetNodeConfig ¶
GetNodeConfig returns the stored node settings, the outbound credentials masked. A malformed DNS or outbound document is reported as an error instead of taking the process down.
func (*Service) GetNodeMultiplier ¶
GetNodeMultiplier returns the stored node traffic multiplier periods. A malformed document is reported as an error.
func (*Service) GetPrivacyPolicyConfig ¶
GetPrivacyPolicyConfig returns the stored privacy policy, which lives in the tos settings category.
func (*Service) GetRegisterConfig ¶
GetRegisterConfig returns the stored registration settings.
func (*Service) GetSiteConfig ¶
GetSiteConfig returns the stored site settings.
func (*Service) GetSubscribeConfig ¶
GetSubscribeConfig returns the stored subscription settings.
func (*Service) GetTosConfig ¶
GetTosConfig returns the stored terms of service.
func (*Service) GetVerifyCodeConfig ¶
GetVerifyCodeConfig returns the stored verification code settings.
func (*Service) GetVerifyConfig ¶
GetVerifyConfig returns the stored verification settings, the Turnstile secret masked. It only reads: the running configuration is re-initialized when the settings are updated.
func (*Service) PreViewNodeMultiplier ¶
func (s *Service) PreViewNodeMultiplier(_ context.Context) (*dto.PreViewNodeMultiplierResponse, error)
PreViewNodeMultiplier reports the node traffic multiplier in effect now.
func (*Service) SetNodeMultiplier ¶
SetNodeMultiplier stores the node traffic multiplier periods, with the audit row of the change, and reloads the node subsystem, which evaluates them.
func (*Service) SettingTelegramBot ¶
SettingTelegramBot reloads the Telegram bot from its stored settings. The reload re-registers the webhook and the command menu, so it is recorded like a settings change; a trail that cannot be written is logged, the reload being what the administrator asked for.
func (*Service) UpdateCurrencyConfig ¶
UpdateCurrencyConfig stores the currency settings and, once they are stored, reloads the currency subsystem: a failed write must not reload a configuration that did not change. A masked access key keeps the stored one.
func (*Service) UpdateInviteConfig ¶
UpdateInviteConfig stores the invitation settings and reloads the invite subsystem.
func (*Service) UpdateNodeConfig ¶
UpdateNodeConfig stores the node settings, kept in the server settings category, and reloads the node subsystem. Masked outbound credentials keep the stored ones.
func (*Service) UpdatePrivacyPolicyConfig ¶
func (s *Service) UpdatePrivacyPolicyConfig(ctx context.Context, req *dto.PrivacyPolicyConfig) error
UpdatePrivacyPolicyConfig stores the privacy policy in the tos settings category. No running subsystem reads it, so nothing is reloaded.
func (*Service) UpdateRegisterConfig ¶
UpdateRegisterConfig stores the registration settings and reloads the register subsystem.
func (*Service) UpdateSiteConfig ¶
UpdateSiteConfig stores the site settings, every value as written, and reloads the site subsystem.
func (*Service) UpdateSubscribeConfig ¶
UpdateSubscribeConfig stores the subscription settings. A new subscribe path needs the HTTP routes rebuilt, so the server restarts in the background instead of reloading the subscribe subsystem; a failed restart is only logged, the settings being stored.
func (*Service) UpdateTosConfig ¶
UpdateTosConfig stores the terms of service. No running subsystem reads them, so nothing is reloaded.
func (*Service) UpdateVerifyCodeConfig ¶
UpdateVerifyCodeConfig stores the verification code settings and reloads the verify subsystem, which enforces them.
func (*Service) UpdateVerifyConfig ¶
UpdateVerifyConfig stores the verification settings and reloads the verify subsystem from them. A masked Turnstile secret keeps the stored one.
type SettingsStore ¶ added in v1.21.0
type SettingsStore interface {
SettingsWriter
AuditWriter
}
SettingsStore is what one settings update reaches inside its transaction: the settings it writes and the audit trail it records the change in.
type SettingsTransactor ¶ added in v1.21.0
type SettingsTransactor interface {
InSettingsTx(ctx context.Context, fn func(SettingsStore) error) error
}
SettingsTransactor runs the writes of one settings update in a single transaction, so an update and its audit row are stored whole or not at all.
func NewSettingsTransactor ¶ added in v1.21.0
func NewSettingsTransactor(store PlatformTransactor) SettingsTransactor
NewSettingsTransactor runs the settings writes in platform-scoped transactions of store, on its system settings and system log repositories.
Source Files
¶
- getcurrencyconfig.go
- getinviteconfig.go
- getnodeconfig.go
- getnodemultiplier.go
- getprivacypolicyconfig.go
- getregisterconfig.go
- getsiteconfig.go
- getsubscribeconfig.go
- gettosconfig.go
- getverifycodeconfig.go
- getverifyconfig.go
- previewnodemultiplier.go
- secrets.go
- service.go
- setnodemultiplier.go
- settingtelegrambot.go
- update_config.go
- updatecurrencyconfig.go
- updateinviteconfig.go
- updatenodeconfig.go
- updateprivacypolicyconfig.go
- updateregisterconfig.go
- updatesiteconfig.go
- updatesubscribeconfig.go
- updatetosconfig.go
- updateverifycodeconfig.go
- updateverifyconfig.go