Skip to main content

kellnr_settings/
gcs.rs

1use provcfg::{ClapArgs, Configurable};
2use serde::{Deserialize, Serialize};
3use utoipa::ToSchema;
4
5#[derive(Debug, Deserialize, Serialize, Eq, PartialEq, Clone, Configurable, ClapArgs, ToSchema)]
6#[serde(default)]
7#[configurable(clap_prefix = "gcs")]
8pub struct Gcs {
9    pub enabled: bool,
10
11    /// Base URL override for self-hosted or emulator endpoints (e.g. fake-gcs-server
12    /// in tests). When unset, requests go to the public Google Cloud Storage API.
13    pub endpoint: Option<String>,
14
15    /// Allow plain HTTP connections. Needed when `endpoint` points at an HTTP endpoint.
16    pub allow_http: bool,
17
18    /// Skip credential lookup and request signing. Only for unauthenticated endpoints
19    /// such as emulators. When false, credentials come from the environment
20    /// (Application Default Credentials).
21    pub skip_signature: bool,
22
23    pub crates_bucket: String,
24
25    pub cratesio_bucket: String,
26
27    pub toolchain_bucket: String,
28
29    pub docs_bucket: Option<String>,
30
31    /// GCS connect timeout in seconds
32    #[arg(long = "gcs-connect-timeout")]
33    pub connect_timeout_seconds: u64,
34
35    /// GCS request timeout in seconds
36    #[arg(long = "gcs-request-timeout")]
37    pub request_timeout_seconds: u64,
38}
39
40impl Default for Gcs {
41    fn default() -> Self {
42        Self {
43            enabled: false,
44            endpoint: None,
45            allow_http: true,
46            skip_signature: false,
47            crates_bucket: "kellnr-crates".to_string(),
48            cratesio_bucket: "kellnr-cratesio".to_string(),
49            toolchain_bucket: "kellnr-toolchains".to_string(),
50            docs_bucket: None,
51            connect_timeout_seconds: 5,
52            request_timeout_seconds: 30,
53        }
54    }
55}