Skip to main content

tatara_github_watcher/
config.rs

1//! Typed runtime config for the watcher.
2
3use clap::Parser;
4
5/// Typed watcher config — CLI flags + env-var overrides.
6#[derive(Parser, Debug, Clone)]
7#[command(name = "tatara-github-watcher")]
8pub struct WatcherConfig {
9    /// HTTP listen address (host:port). The webhook URL operators
10    /// configure in GitHub points here.
11    #[arg(long, env = "TATARA_WATCHER_LISTEN", default_value = "0.0.0.0:8080")]
12    pub listen: String,
13
14    /// GitHub webhook secret. Operator-supplied; must match what
15    /// they set in the GitHub org webhook config.
16    #[arg(long, env = "TATARA_WATCHER_SECRET")]
17    pub secret: String,
18
19    /// Namespace where EphemeralAllocation CRs are created. Defaults
20    /// to `"ephemeral-pools"`.
21    #[arg(long, env = "TATARA_WATCHER_NAMESPACE", default_value = "ephemeral-pools")]
22    pub namespace: String,
23
24    /// Pin all allocations to a named pool (skips selector routing).
25    /// Useful for single-pool deployments.
26    #[arg(long, env = "TATARA_WATCHER_PIN_POOL")]
27    pub pin_pool: Option<String>,
28
29    /// Whether draft PRs receive allocations. Default: false.
30    #[arg(long, env = "TATARA_WATCHER_INCLUDE_DRAFTS")]
31    pub include_drafts: bool,
32
33    /// If set, restrict the watcher to PRs from this allowlist of
34    /// `org/*` or `org/repo` patterns (comma-separated). Empty = accept
35    /// every repo.
36    #[arg(long, env = "TATARA_WATCHER_ALLOW_REPOS", value_delimiter = ',')]
37    pub allow_repos: Vec<String>,
38}