forked from cadey/xesite
tolerate no patrone creds
Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
parent
e5ee825c0a
commit
3a5c7adc42
|
@ -90,7 +90,7 @@ pub enum Error {
|
||||||
URLParse(#[from] url::ParseError),
|
URLParse(#[from] url::ParseError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, Eq, PartialEq)]
|
||||||
pub struct Credentials {
|
pub struct Credentials {
|
||||||
pub client_id: String,
|
pub client_id: String,
|
||||||
pub client_secret: String,
|
pub client_secret: String,
|
||||||
|
|
|
@ -22,6 +22,11 @@ async fn patrons() -> Result<Option<patreon::Users>> {
|
||||||
let creds: Credentials = envy::prefixed("PATREON_")
|
let creds: Credentials = envy::prefixed("PATREON_")
|
||||||
.from_env()
|
.from_env()
|
||||||
.unwrap_or(Credentials::default());
|
.unwrap_or(Credentials::default());
|
||||||
|
|
||||||
|
if creds == Credentials::default() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
let mut cli = Client::new(creds)?;
|
let mut cli = Client::new(creds)?;
|
||||||
|
|
||||||
cli.refresh_token().await?;
|
cli.refresh_token().await?;
|
||||||
|
|
Loading…
Reference in New Issue