store

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

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 DefaultDebugSettingsData = spec.DebugSettings{
	LogLLMReqResp:           false,
	DisableContentStripping: false,
	LogLevel:                spec.DebugLogLevelInfo,
}

DefaultDebugSettingsData is written to disk on first start and used for migrations.

View Source
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

DeleteAuthKey removes a key unless it is marked built-in.

func (*SettingStore) GetAuthKey

GetAuthKey returns the decrypted secret for one key.

func (*SettingStore) GetSettings

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

SetAppTheme validates and persists a new theme.

func (*SettingStore) SetAuthKey

SetAuthKey inserts or updates one auth-key.

func (*SettingStore) SetDebugSettings added in v0.0.91

SetDebugSettings validates and persists runtime debug settings.

func (*SettingStore) SetDebugSettingsApplier added in v0.0.91

func (s *SettingStore) SetDebugSettingsApplier(applier DebugSettingsApplier)

Jump to

Keyboard shortcuts

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