From 9499c195230a7d5adaebd46892b373c86c5248c2 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 20 Jan 2024 14:47:39 +0100 Subject: seperate secrets config file --- base/src/federation.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'base/src/federation.rs') 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 */ -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::>(); 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( -- cgit v1.2.3-70-g09d2