Documentation
¶
Index ¶
- Variables
- func InitSettingStoreHandlers(api huma.API, s *SettingStore)
- type SettingStore
- func (s *SettingStore) DeleteAuthKey(_ context.Context, req *spec.DeleteAuthKeyRequest) (*spec.DeleteAuthKeyResponse, error)
- func (s *SettingStore) GetAuthKey(_ context.Context, req *spec.GetAuthKeyRequest) (*spec.GetAuthKeyResponse, error)
- func (s *SettingStore) GetSettings(_ context.Context, req *spec.GetSettingsRequest) (*spec.GetSettingsResponse, error)
- func (s *SettingStore) Migrate(ctx context.Context) error
- func (s *SettingStore) SetAppTheme(_ context.Context, req *spec.SetAppThemeRequest) (*spec.SetAppThemeResponse, error)
- func (s *SettingStore) SetAuthKey(_ context.Context, req *spec.SetAuthKeyRequest) (*spec.SetAuthKeyResponse, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var BuiltInAuthKeys = func() map[spec.AuthKeyType][]spec.AuthKeyName { m := map[spec.AuthKeyType][]spec.AuthKeyName{ spec.AuthKeyTypeProvider: {}, } for _, p := range builtin.BuiltInProviderNames { m[spec.AuthKeyTypeProvider] = append( m[spec.AuthKeyTypeProvider], spec.AuthKeyName(p), ) } return m }()
BuiltInAuthKeys lists every key that must never be deleted.
View Source
var DefaultSettingsData = func() spec.SettingsSchema { ak := spec.AuthKeysSchema{ spec.AuthKeyTypeProvider: map[spec.AuthKeyName]spec.AuthKey{}, } for _, p := range builtin.BuiltInProviderNames { ak[spec.AuthKeyTypeProvider][spec.AuthKeyName(p)] = spec.AuthKey{ Secret: "", SHA256: computeSHA(""), NonEmpty: false, } } return spec.SettingsSchema{ SchemaVersion: spec.SchemaVersion, AppTheme: spec.AppTheme{Type: spec.ThemeSystem, Name: string(spec.ThemeSystem)}, AuthKeys: ak, } }()
DefaultSettingsData is written to disk on first start.
Functions ¶
func InitSettingStoreHandlers ¶
func InitSettingStoreHandlers(api huma.API, s *SettingStore)
Types ¶
type SettingStore ¶
type SettingStore struct {
// contains filtered or unexported fields
}
func NewSettingStore ¶
func NewSettingStore(baseDir string) (*SettingStore, error)
func (*SettingStore) DeleteAuthKey ¶
func (s *SettingStore) DeleteAuthKey( _ context.Context, req *spec.DeleteAuthKeyRequest, ) (*spec.DeleteAuthKeyResponse, error)
DeleteAuthKey removes a key unless it is marked built-in.
func (*SettingStore) GetAuthKey ¶
func (s *SettingStore) GetAuthKey( _ context.Context, req *spec.GetAuthKeyRequest, ) (*spec.GetAuthKeyResponse, error)
GetAuthKey returns the decrypted secret for one key.
func (*SettingStore) GetSettings ¶
func (s *SettingStore) GetSettings( _ context.Context, req *spec.GetSettingsRequest, ) (*spec.GetSettingsResponse, error)
GetSettings returns the current settings without secrets.
func (*SettingStore) Migrate ¶
func (s *SettingStore) Migrate(ctx context.Context) error
Migrate ensures the store is up-to-date with built-in data. - Adds missing built-in auth keys as empty entries. - Updates schemaVersion if changed.
func (*SettingStore) SetAppTheme ¶
func (s *SettingStore) SetAppTheme( _ context.Context, req *spec.SetAppThemeRequest, ) (*spec.SetAppThemeResponse, error)
SetAppTheme validates and persists a new theme.
func (*SettingStore) SetAuthKey ¶
func (s *SettingStore) SetAuthKey( _ context.Context, req *spec.SetAuthKeyRequest, ) (*spec.SetAuthKeyResponse, error)
SetAuthKey inserts or updates one auth-key.
Click to show internal directories.
Click to hide internal directories.