diff --git a/Cargo.lock b/Cargo.lock
index ea7fdca3a..f6421fad8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 3
+
[[package]]
name = "activitystreams"
version = "0.7.0-alpha.10"
@@ -1101,6 +1103,15 @@ dependencies = [
"termcolor",
]
+[[package]]
+name = "envy"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "event-listener"
version = "2.5.1"
@@ -1953,6 +1964,7 @@ dependencies = [
"comrak",
"deser-hjson",
"diesel",
+ "envy",
"futures",
"http",
"itertools",
@@ -1960,7 +1972,6 @@ dependencies = [
"lazy_static",
"lettre",
"log",
- "merge",
"openssl",
"percent-encoding",
"rand 0.8.3",
@@ -2113,28 +2124,6 @@ dependencies = [
"autocfg",
]
-[[package]]
-name = "merge"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9"
-dependencies = [
- "merge_derive",
- "num-traits",
-]
-
-[[package]]
-name = "merge_derive"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "209d075476da2e63b4b29e72a2ef627b840589588e71400a25e3565c4f849d07"
-dependencies = [
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
-
[[package]]
name = "migrations_internals"
version = "1.4.1"
@@ -2568,30 +2557,6 @@ dependencies = [
"vcpkg",
]
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
diff --git a/api_tests/prepare-drone-federation-test.sh b/api_tests/prepare-drone-federation-test.sh
index 32eb75136..de9b7b844 100755
--- a/api_tests/prepare-drone-federation-test.sh
+++ b/api_tests/prepare-drone-federation-test.sh
@@ -1,6 +1,13 @@
#!/bin/bash
set -e
+export LEMMY_JWT_SECRET=changeme
+export LEMMY_FEDERATION__ENABLED=true
+export LEMMY_TLS_ENABLED=false
+export LEMMY_SETUP__ADMIN_PASSWORD=lemmy
+export LEMMY_RATE_LIMIT__POST=99999
+export LEMMY_RATE_LIMIT__REGISTER=99999
+export LEMMY_CAPTCHA__ENABLED=false
export LEMMY_TEST_SEND_SYNC=1
export RUST_BACKTRACE=1
@@ -28,39 +35,52 @@ fi
killall lemmy_server || true
-echo "$PWD"
-
echo "start alpha"
LEMMY_HOSTNAME=lemmy-alpha:8541 \
- LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_alpha.hjson \
+ LEMMY_PORT=8541 \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
- target/lemmy_server >/tmp/lemmy_alpha.out 2>&1 &
+ LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon \
+ LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha \
+ LEMMY_SETUP__SITE_NAME=lemmy-alpha \
+ target/lemmy_server >/dev/null 2>&1 &
echo "start beta"
LEMMY_HOSTNAME=lemmy-beta:8551 \
- LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_beta.hjson \
+ LEMMY_PORT=8551 \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
- target/lemmy_server >/tmp/lemmy_beta.out 2>&1 &
+ LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon \
+ LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta \
+ LEMMY_SETUP__SITE_NAME=lemmy-beta \
+ target/lemmy_server >/dev/null 2>&1 &
echo "start gamma"
LEMMY_HOSTNAME=lemmy-gamma:8561 \
- LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_gamma.hjson \
+ LEMMY_PORT=8561 \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
- target/lemmy_server >/tmp/lemmy_gamma.out 2>&1 &
+ LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon \
+ LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma \
+ LEMMY_SETUP__SITE_NAME=lemmy-gamma \
+ target/lemmy_server >/dev/null 2>&1 &
echo "start delta"
# An instance with only an allowlist for beta
LEMMY_HOSTNAME=lemmy-delta:8571 \
- LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_delta.hjson \
+ LEMMY_PORT=8571 \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
- target/lemmy_server >/tmp/lemmy_delta.out 2>&1 &
+ LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta \
+ LEMMY_SETUP__ADMIN_USERNAME=lemmy_delta \
+ LEMMY_SETUP__SITE_NAME=lemmy-delta \
+ target/lemmy_server >/dev/null 2>&1 &
echo "start epsilon"
# An instance who has a blocklist, with lemmy-alpha blocked
LEMMY_HOSTNAME=lemmy-epsilon:8581 \
- LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_epsilon.hjson \
+ LEMMY_PORT=8581 \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
- target/lemmy_server >/tmp/lemmy_epsilon.out 2>&1 &
+ LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha \
+ LEMMY_SETUP__ADMIN_USERNAME=lemmy_epsilon \
+ LEMMY_SETUP__SITE_NAME=lemmy-epsilon \
+ target/lemmy_server >/dev/null 2>&1 &
echo "wait for all instances to start"
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8541/api/v2/site')" != "200" ]]; do sleep 1; done
diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs
index d934d1acc..7caaba3b9 100644
--- a/crates/api/src/lib.rs
+++ b/crates/api/src/lib.rs
@@ -190,7 +190,7 @@ pub(crate) fn check_optional_url(item: &Option