Initial commit
This is definitely not functional yet. Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
29
bank2ff/src/config.rs
Normal file
29
bank2ff/src/config.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user