Skip to main content

nflverse_data/
config.rs

1use time::OffsetDateTime;
2
3use utils::Secret;
4
5#[derive(Debug, Clone)]
6pub struct NflDataConfig {
7    pub database_url: String,
8    /// Per-season datasets fetch seasons >= this. Lower bound only, so the
9    /// exact NFL season boundary doesn't matter.
10    pub earliest_season: u16,
11    /// Optional token to raise the GitHub API rate limit. Never required.
12    pub github_token: Option<Secret>,
13    /// Overridable so tests can point at a mock server.
14    pub github_api_base: String,
15}
16
17impl Default for NflDataConfig {
18    fn default() -> Self {
19        Self {
20            database_url: "sqlite://storage/nflverse-cache.db".into(),
21            earliest_season: (OffsetDateTime::now_utc().year() - 2) as u16,
22            github_token: None,
23            github_api_base: "https://api.github.com".into(),
24        }
25    }
26}