Files
banks2ff/bank2ff/src/config.rs

30 lines
782 B
Rust
Raw Normal View History

use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub(super) struct AppConfiguration {
pub(crate) firefly_iii_url: String,
pub(crate) firefly_iii_api_key: String,
pub(crate) go_cardless_key: String,
pub(crate) go_cardless_id: String,
}
impl AppConfiguration {
pub(super) fn from_env() -> Result<Self, dotenv::Error> {
use dotenv::var;
let firefly_iii_url = var("FIREFLY_III_URL")?;
let firefly_iii_api_key = var("FIREFLY_III_API_KEY")?;
let go_cardless_key = var("GOCARDLESS_KEY")?;
let go_cardless_id = var("GOCARDLESS_ID")?;
Ok(Self {
firefly_iii_url,
firefly_iii_api_key,
go_cardless_key,
go_cardless_id,
})
}
}