appsettings

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

func GetAllSettings() (map[string]string, error)

GetAllSettings returns all settings as a map.

func GetSetting

func GetSetting(key string) (string, error)

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

func SetSetting(key, value string) error

SetSetting inserts or replaces a setting key-value pair.

Types

This section is empty.

Jump to

Keyboard shortcuts

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