Documentation
¶
Index ¶
- Variables
- func InitSettingStoreHandlers(api huma.API, s *SettingStore)
- type DebugSettingsApplier
- type SettingStore
- func (s *SettingStore) ApplyCurrentDebugSettings(ctx context.Context, forceFetch bool) error
- func (s *SettingStore) Close() error
- 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)
- func (s *SettingStore) SetDebugSettings(ctx context.Context, req *spec.SetDebugSettingsRequest) (*spec.SetDebugSettingsResponse, error)
- func (s *SettingStore) SetDebugSettingsApplier(applier DebugSettingsApplier)
Constants ¶
This section is empty.
Variables ¶
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.
var DefaultDebugSettingsData = spec.DebugSettings{ LogLLMReqResp: false, DisableContentStripping: false, LogLevel: spec.DebugLogLevelInfo, }
DefaultDebugSettingsData is written to disk on first start and used for migrations.
var DefaultSettingsData = func() spec.SettingsSchema { ak := spec.AuthKeysSchema{ spec.AuthKeyTypeProvider: map[spec.AuthKeyName]spec.AuthKey{}, spec.AuthKeyTypeMCP: 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)}, Debug: DefaultDebugSettingsData, AuthKeys: ak, } }()
DefaultSettingsData is written to disk on first start.
Functions ¶
func InitSettingStoreHandlers ¶
func InitSettingStoreHandlers(api huma.API, s *SettingStore)
Types ¶
type DebugSettingsApplier ¶ added in v0.0.91
type DebugSettingsApplier func(context.Context, spec.DebugSettings) error
type SettingStore ¶
type SettingStore struct {
// contains filtered or unexported fields
}
func NewSettingStore ¶
func NewSettingStore(baseDir string) (*SettingStore, error)
func (*SettingStore) ApplyCurrentDebugSettings ¶ added in v0.0.91
func (s *SettingStore) ApplyCurrentDebugSettings(ctx context.Context, forceFetch bool) error
func (*SettingStore) Close ¶ added in v0.0.79
func (s *SettingStore) Close() 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. - Adds new settings sections/fields with defaults. - 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.
func (*SettingStore) SetDebugSettings ¶ added in v0.0.91
func (s *SettingStore) SetDebugSettings( ctx context.Context, req *spec.SetDebugSettingsRequest, ) (*spec.SetDebugSettingsResponse, error)
SetDebugSettings validates and persists runtime debug settings.
func (*SettingStore) SetDebugSettingsApplier ¶ added in v0.0.91
func (s *SettingStore) SetDebugSettingsApplier(applier DebugSettingsApplier)