Documentation
¶
Index ¶
- func EnsureDefaults() error
- func GetAllSettings() (map[string]string, error)
- func GetSetting(key string) (string, error)
- func HandleOnboarding(w http.ResponseWriter, r *http.Request)
- func HandleSettings(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 HandleOnboarding ¶
func HandleOnboarding(w http.ResponseWriter, r *http.Request)
HandleOnboarding is a public endpoint that returns the current onboarding status. GET /admin/api/onboarding → {"onboarded": bool} @Summary Check onboarding status @Description Returns whether the system has been initialized with an admin account and the current OAuth path. @Tags onboarding @Produce json @Success 200 {object} map[string]any @Router /admin/api/onboarding [get]
func HandleSettings ¶
func HandleSettings(w http.ResponseWriter, r *http.Request)
HandleSettings is an admin-protected endpoint for reading and updating settings. GET /admin/api/settings → returns all settings as a JSON object PUT /admin/api/settings → accepts a JSON object and updates matching keys @Summary System settings @Description GET: Retrieve all system settings (except sensitive values). PUT: Update multiple settings. @Tags admin @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]string "All settings (GET)" @Success 204 "Settings updated (PUT)" @Router /admin/api/settings [get] @Router /admin/api/settings [put]
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.