Add env var to disable outbound federation

This commit is contained in:
Shadowfacts 2023-01-05 15:58:20 -05:00
parent 0884fe7589
commit 6843df46f0
1 changed files with 6 additions and 1 deletions

View File

@ -4,7 +4,7 @@ use anyhow::anyhow;
use chrono::Utc;
use http_signature_normalization::Config;
use hyper::header::CONTENT_TYPE;
use log::{debug, error};
use log::{debug, error, info};
use openssl::{hash::MessageDigest, pkey::PKey, sha::Sha256, sign::Signer};
use reqwest::header::{ACCEPT, DATE, HOST};
use std::collections::BTreeMap;
@ -25,6 +25,11 @@ pub async fn sign_and_send<Kind: serde::Serialize>(
activity: &ActorAndObject<Kind>,
inbox: &str,
) -> anyhow::Result<()> {
if std::env::var("SKIP_FEDERATE").is_ok() {
info!("Skipping federation");
return Ok(());
}
let inbox_url = Url::parse(inbox)?;
let body = serde_json::to_string(activity)?;