Documentation
¶
Index ¶
- Constants
- func DefaultTMDBKey() string
- func DefaultTraktClientID() string
- func EnsureAPIKey(cfg *Config) (generated bool, err error)
- func WriteConfigKey(configFile, key, value string) (writePath string, err error)
- type AIConfig
- type AuthConfig
- type Config
- type DatabaseConfig
- type LogConfig
- type MediaInfoConfig
- type PulseConfig
- type Secret
- type ServerConfig
- type TMDBConfig
- type TraktConfig
Constants ¶
const ( DefaultHost = "0.0.0.0" DefaultPort = 8282 DefaultLogLevel = "info" DefaultLogFormat = "json" DefaultAIMatchModel = "claude-sonnet-4-6" DefaultAIScoreModel = "claude-haiku-4-5-20251001" DefaultAIFilterModel = "claude-haiku-4-5-20251001" )
Variables ¶
This section is empty.
Functions ¶
func DefaultTMDBKey ¶
func DefaultTMDBKey() string
DefaultTMDBKey returns the baked-in TMDB API key (de-obfuscated) or an empty string if no key was provided at build time. This is the only way the key appears in plaintext — never log, never return via an API response.
func DefaultTraktClientID ¶
func DefaultTraktClientID() string
DefaultTraktClientID returns the baked-in Trakt client ID.
func EnsureAPIKey ¶
EnsureAPIKey generates a random API key if none is configured. The generated key is returned and must be shown to the user — it is only ever logged once.
func WriteConfigKey ¶
WriteConfigKey writes a single dot-notation key (e.g. "tmdb.api_key") to the given YAML config file, creating the file and parent directories if needed. If configFile is empty, the default path (~/.config/prism/config.yaml, or /config/config.yaml in Docker) is used.
Existing keys in the file are preserved; only the target key is updated. Returns the actual file path that was written.
Types ¶
type AIConfig ¶
type AIConfig struct {
APIKey Secret `mapstructure:"api_key"`
MatchModel string `mapstructure:"match_model"`
ScoreModel string `mapstructure:"score_model"`
FilterModel string `mapstructure:"filter_model"`
}
AIConfig holds Claude API credentials and model selection.
type AuthConfig ¶
type AuthConfig struct {
APIKey Secret `mapstructure:"api_key"`
}
AuthConfig holds the Prism API key used to authenticate requests.
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig `mapstructure:"database"`
Log LogConfig `mapstructure:"log"`
TMDB TMDBConfig `mapstructure:"tmdb"`
Trakt TraktConfig `mapstructure:"trakt"`
AI AIConfig `mapstructure:"ai"`
Auth AuthConfig `mapstructure:"auth"`
MediaInfo MediaInfoConfig `mapstructure:"mediainfo"`
Pulse PulseConfig `mapstructure:"pulse"`
// ConfigFile is the path of the config file that was loaded, if any.
// Empty when running on defaults/env vars only.
ConfigFile string `mapstructure:"-"`
// TMDBKeyIsDefault is true when the TMDB key came from the build-time
// default rather than user configuration.
TMDBKeyIsDefault bool `mapstructure:"-"`
}
Config holds all application configuration. Values are loaded from config.yaml and can be overridden by PRISM_* environment variables (e.g. PRISM_SERVER_PORT=8080).
func Load ¶
Load reads configuration from a YAML file and environment variables. If cfgFile is empty, the following paths are searched in order:
/config/config.yaml (Docker volume mount) $HOME/.config/prism/config.yaml /etc/prism/config.yaml ./config.yaml
Missing config file is not an error — defaults and environment variables are always applied.
type DatabaseConfig ¶
type DatabaseConfig struct {
// Path is the SQLite database file location.
Path string `mapstructure:"path"`
}
DatabaseConfig configures the SQLite database.
type LogConfig ¶
type LogConfig struct {
// Level is one of: debug, info, warn, error. Default: info.
Level string `mapstructure:"level"`
// Format is one of: json, text. Default: json.
Format string `mapstructure:"format"`
}
LogConfig controls log output format and verbosity.
type MediaInfoConfig ¶
type MediaInfoConfig struct {
// FFprobePath is the path to the ffprobe binary. Empty means search $PATH.
FFprobePath string `mapstructure:"ffprobe_path"`
// ScanTimeout is the per-file timeout for ffprobe. Default: "30s".
ScanTimeout string `mapstructure:"scan_timeout"`
// ScanOnImport enables automatic scanning after a successful import.
ScanOnImport bool `mapstructure:"scan_on_import"`
}
MediaInfoConfig controls optional ffprobe-based media scanning.
type PulseConfig ¶
type PulseConfig struct {
// URL is the base URL of the Pulse instance (e.g. "http://pulse:9696").
URL string `mapstructure:"url"`
// APIKey is the Pulse API key.
APIKey Secret `mapstructure:"api_key"`
// APIKeyFile points at a file (typically /run/secrets/*) containing
// Pulse's API key. When non-empty, its contents replace APIKey at
// load time.
APIKeyFile string `mapstructure:"api_key_file"`
}
PulseConfig holds optional Pulse integration settings. When URL and APIKey are set, Prism will register itself with Pulse on startup and auto-discover ecosystem services.
type Secret ¶
type Secret string
Secret is a string type that never reveals its contents when logged, printed, or serialized. Use it for API keys, passwords, and tokens.
Call .Value() when you actually need the underlying string (e.g. to make an authenticated HTTP request).
func (Secret) LogValue ¶
LogValue implements slog.LogValuer. Always returns "***". Prevents exposure in structured log output.
func (Secret) MarshalJSON ¶
MarshalJSON always serializes as the string "***". Prevents accidental exposure in JSON API responses.
func (Secret) MarshalText ¶
MarshalText always encodes as "***". Covers YAML, TOML, and other text-based serializers.
type ServerConfig ¶
ServerConfig controls the HTTP server.
type TMDBConfig ¶
type TMDBConfig struct {
APIKey Secret `mapstructure:"api_key"`
}
TMDBConfig holds The Movie Database API credentials.
type TraktConfig ¶
type TraktConfig struct {
ClientID Secret `mapstructure:"client_id"`
}
TraktConfig holds the Trakt API credentials. The ClientID is the app-level API key (trakt-api-key header). Public endpoints only need this.