2021-12-17 23:50:03 +01:00
|
|
|
use std::net::SocketAddr;
|
2021-12-18 20:04:34 +01:00
|
|
|
use reqwest::Url;
|
2021-12-17 23:50:03 +01:00
|
|
|
use serde::Deserialize;
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct Config {
|
|
|
|
pub addr: SocketAddr,
|
|
|
|
pub database: String,
|
|
|
|
pub cdn: String,
|
2021-12-18 20:04:34 +01:00
|
|
|
pub ipfs_api: Url,
|
2021-12-17 23:50:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct ConfVars {
|
|
|
|
pub cdn: String,
|
2021-12-18 20:04:34 +01:00
|
|
|
pub ipfs_api: Url,
|
2021-12-17 23:50:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Config {
|
|
|
|
|
|
|
|
pub fn vars(&self) -> ConfVars {
|
|
|
|
ConfVars {
|
|
|
|
cdn: self.cdn.clone(),
|
2021-12-18 20:04:34 +01:00
|
|
|
ipfs_api: self.ipfs_api.clone(),
|
2021-12-17 23:50:03 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Clone for ConfVars {
|
|
|
|
fn clone(&self) -> Self {
|
2021-12-18 20:04:34 +01:00
|
|
|
Self { cdn: self.cdn.clone(), ipfs_api: self.ipfs_api.clone() }
|
2021-12-17 23:50:03 +01:00
|
|
|
}
|
|
|
|
}
|