Documentation
¶
Overview ¶
Package settings holds the operational config every real product needs — project name, timezone, managed API keys, and the session-signing secret — persisted as a single JSON file (atomic rewrite), separate from event data.
Index ¶
- type APIKey
- type Account
- type Store
- func (s *Store) AddKey(name string) (APIKey, error)
- func (s *Store) CheckPassword(password string) bool
- func (s *Store) HasPassword() bool
- func (s *Store) Keys() []APIKey
- func (s *Store) ProjectName() string
- func (s *Store) RetainDays() int
- func (s *Store) RevokeKey(id string) error
- func (s *Store) RotateSecret() error
- func (s *Store) Secret() string
- func (s *Store) SetAccount(username, password string) error
- func (s *Store) SetRetainDays(days int) error
- func (s *Store) Timezone() string
- func (s *Store) UpdateProject(name, tz string) error
- func (s *Store) Username() string
- func (s *Store) ValidKey(key string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
ID string `json:"id"`
Name string `json:"name"`
Key string `json:"key"`
Created time.Time `json:"created"`
}
APIKey is a managed ingestion key (in addition to any env-configured key).
type Account ¶
type Account struct {
Username string `json:"username"`
Hash string `json:"hash"` // iterated HMAC-SHA256 of the password
Salt string `json:"salt"`
}
Account is the single operator login (in-app, self-serve — no env required).
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the concurrency-safe, persisted settings.
func (*Store) CheckPassword ¶
CheckPassword verifies a password against the stored hash (constant-time).
func (*Store) HasPassword ¶
func (*Store) ProjectName ¶
func (*Store) RetainDays ¶
func (*Store) RotateSecret ¶
RotateSecret generates a new session-signing secret, invalidating every existing session cookie ("sign out everywhere").
func (*Store) SetAccount ¶
SetAccount sets the operator username + password (hashed). Empty username keeps the existing one.