diff --git a/Cargo.lock b/Cargo.lock index 6b7f0f1..304f6e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2592,6 +2592,7 @@ dependencies = [ "mime", "patreon", "pfacts", + "pretty_env_logger", "prometheus", "rand 0.7.3", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index 354fead..901fe65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ pfacts = "0" serde_json = "1" eyre = "0.6" reqwest = { version = "0.10", features = ["json"] } +pretty_env_logger = "0" [workspace] members = [ diff --git a/lib/patreon/src/lib.rs b/lib/patreon/src/lib.rs index d61bb8c..14faffe 100644 --- a/lib/patreon/src/lib.rs +++ b/lib/patreon/src/lib.rs @@ -71,7 +71,7 @@ pub enum Error { Request(#[from] reqwest::Error), } -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct Credentials { pub client_id: String, pub client_secret: String, diff --git a/src/app/mod.rs b/src/app/mod.rs index e625160..035db07 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -19,7 +19,7 @@ pub struct Config { #[instrument] async fn patrons() -> Result> { use patreon::*; - let creds: Credentials = envy::prefixed("PATREON_").from_env().unwrap(); + let creds: Credentials = envy::prefixed("PATREON_").from_env().unwrap_or(Credentials::default()); let cli = Client::new(creds); match cli.campaign().await {