Documentation
¶
Index ¶
- func EnsureDefaults() error
- func GetAllSettings() (map[string]string, error)
- func GetSetting(key string) (string, error)
- func HandleExportSettings(w http.ResponseWriter, _ *http.Request)
- func HandleGetSettings(w http.ResponseWriter, _ *http.Request)
- func HandleImportApply(w http.ResponseWriter, r *http.Request)
- func HandleImportPreview(w http.ResponseWriter, r *http.Request)
- func HandlePutSettings(w http.ResponseWriter, r *http.Request)
- func HandleTestSmtp(w http.ResponseWriter, r *http.Request)
- func IsOnboarded() bool
- func LoadIntoConfig() error
- func SetSetting(key, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDefaults ¶
func EnsureDefaults() error
EnsureDefaults writes any missing well-known keys with their default values. Existing values are never overwritten.
func GetAllSettings ¶
GetAllSettings returns all settings as a map.
func GetSetting ¶
GetSetting retrieves a single setting value by key from the settings table.
func HandleExportSettings ¶ added in v1.6.0
func HandleExportSettings(w http.ResponseWriter, _ *http.Request)
HandleExportSettings godoc @Summary Export settings @Description Export all settings as a JSON file (smtp_password excluded). @Tags admin-settings @Produce json @Security AdminAuth @Success 200 {object} settingsExport @Router /admin/api/settings/export [get]
func HandleGetSettings ¶ added in v1.4.4
func HandleGetSettings(w http.ResponseWriter, _ *http.Request)
HandleGetSettings godoc @Summary Get system settings @Description Retrieve all system settings (except sensitive values). @Tags admin-settings @Produce json @Security AdminAuth @Success 200 {object} map[string]string @Router /admin/api/settings [get]
func HandleImportApply ¶ added in v1.6.0
func HandleImportApply(w http.ResponseWriter, r *http.Request)
HandleImportApply godoc @Summary Apply settings import @Description Applies imported settings, skipping unknown keys and protected fields. @Tags admin-settings @Accept json @Produce json @Security AdminAuth @Success 204 @Router /admin/api/settings/import/apply [post]
func HandleImportPreview ¶ added in v1.6.0
func HandleImportPreview(w http.ResponseWriter, r *http.Request)
HandleImportPreview godoc @Summary Preview settings import @Description Returns a diff of current vs incoming values for all known keys, plus unknown keys. @Tags admin-settings @Accept json @Produce json @Security AdminAuth @Success 200 {object} settingsPreviewResponse @Router /admin/api/settings/import/preview [post]
func HandlePutSettings ¶ added in v1.4.4
func HandlePutSettings(w http.ResponseWriter, r *http.Request)
HandlePutSettings godoc @Summary Update system settings @Description Update multiple settings by key-value pairs. @Tags admin-settings @Accept json @Security AdminAuth @Success 204 @Failure 400 {object} model.ApiError @Failure 500 {object} model.ApiError @Router /admin/api/settings [put]
func HandleTestSmtp ¶ added in v1.5.8
func HandleTestSmtp(w http.ResponseWriter, r *http.Request)
HandleTestSmtp godoc @Summary Test SMTP configuration @Description Sends a test email to the currently authenticated admin's registered email address. @Tags admin-settings @Produce json @Security AdminAuth @Success 200 {object} map[string]string @Failure 400 {object} model.ApiError @Failure 500 {object} model.ApiError @Router /admin/api/settings/test-smtp [post]
func IsOnboarded ¶
func IsOnboarded() bool
IsOnboarded returns true if the onboarded setting is "true".
func LoadIntoConfig ¶
func LoadIntoConfig() error
LoadIntoConfig reads all settings from the DB and populates config.Values.
func SetSetting ¶
SetSetting inserts or replaces a setting key-value pair.
Types ¶
This section is empty.