aboutsummaryrefslogtreecommitdiff
path: root/base/src/federation.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-20 14:47:39 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-20 14:47:39 +0100
commit9499c195230a7d5adaebd46892b373c86c5248c2 (patch)
treeff652e9959dc2f0349a4e5aed75e8837b452e45f /base/src/federation.rs
parent730353601db9818d148c85bfe1ecb119abaab7cc (diff)
downloadjellything-9499c195230a7d5adaebd46892b373c86c5248c2.tar
jellything-9499c195230a7d5adaebd46892b373c86c5248c2.tar.bz2
jellything-9499c195230a7d5adaebd46892b373c86c5248c2.tar.zst
seperate secrets config file
Diffstat (limited to 'base/src/federation.rs')
-rw-r--r--base/src/federation.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/base/src/federation.rs b/base/src/federation.rs
index 9cd04ae..0041e26 100644
--- a/base/src/federation.rs
+++ b/base/src/federation.rs
@@ -3,10 +3,10 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-use crate::CONF;
+use crate::SECRETS;
use anyhow::anyhow;
use jellyclient::{Instance, Session};
-use jellycommon::user::CreateSessionParams;
+use jellycommon::{config::FederationAccount, user::CreateSessionParams};
use std::{collections::HashMap, sync::Arc};
use tokio::sync::RwLock;
@@ -17,10 +17,12 @@ pub struct Federation {
impl Federation {
pub fn initialize() -> Self {
- let instances = CONF
- .remote_credentials
+ let instances = SECRETS
+ .federation
.iter()
- .map(|(k, (_, _, tls))| (k.to_owned(), Instance::new(k.to_owned(), *tls)))
+ .map(|(k, FederationAccount { tls, .. })| {
+ (k.to_owned(), Instance::new(k.to_owned(), *tls))
+ })
.collect::<HashMap<_, _>>();
Self {
@@ -40,8 +42,10 @@ impl Federation {
if let Some(s) = w.get(host) {
Ok(s.to_owned())
} else {
- let (username, password, _) = CONF
- .remote_credentials
+ let FederationAccount {
+ username, password, ..
+ } = SECRETS
+ .federation
.get(host)
.ok_or(anyhow!("no credentials of the remote server"))?;
let s = Arc::new(