feat(config): add events section (session timeout + skip rule thresholds)
This commit is contained in:
@@ -16,6 +16,7 @@ type Config struct {
|
||||
Auth AuthConfig `yaml:"auth"`
|
||||
Library LibraryConfig `yaml:"library"`
|
||||
Subsonic SubsonicConfig `yaml:"subsonic"`
|
||||
Events EventsConfig `yaml:"events"`
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
@@ -55,11 +56,23 @@ type SubsonicConfig struct {
|
||||
AllowPlaintextPassword bool `yaml:"allow_plaintext_password"`
|
||||
}
|
||||
|
||||
// EventsConfig governs play-event ingestion: session window, skip rule.
|
||||
type EventsConfig struct {
|
||||
SessionTimeoutMinutes int `yaml:"session_timeout_minutes"`
|
||||
SkipMaxCompletionRatio float64 `yaml:"skip_max_completion_ratio"`
|
||||
SkipMaxDurationPlayedMs int `yaml:"skip_max_duration_played_ms"`
|
||||
}
|
||||
|
||||
func Default() Config {
|
||||
return Config{
|
||||
Server: ServerConfig{Address: ":4533"},
|
||||
Database: DatabaseConfig{URL: ""},
|
||||
Log: LogConfig{Level: "info", Format: "text"},
|
||||
Events: EventsConfig{
|
||||
SessionTimeoutMinutes: 30,
|
||||
SkipMaxCompletionRatio: 0.5,
|
||||
SkipMaxDurationPlayedMs: 30000,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user