From: Kenneth Koski <kenneth.koski@canonical.com>
Date: Sat, 31 Oct 2020 22:08:03 +0000 (-0500)
Subject: Add iframely_url setting
X-Git-Url: http://these/git/%7Bthis.getImage%28%29%7D?a=commitdiff_plain;h=3d872b03e396e34b266aee6471ed55d93d4c0593;p=lemmy.git

Add iframely_url setting
---

diff --git a/config/defaults.hjson b/config/defaults.hjson
index 0368500b..42222550 100644
--- a/config/defaults.hjson
+++ b/config/defaults.hjson
@@ -37,6 +37,8 @@
   jwt_secret: "changeme"
   # address where pictrs is available
   pictrs_url: "http://pictrs:8080"
+  # address where iframely is available
+  iframely_url: "http://iframely"
   # rate limits for various user actions, by user ip
   rate_limit: {
     # maximum number of messages created in interval
diff --git a/lemmy_utils/src/request.rs b/lemmy_utils/src/request.rs
index cbd778c6..6b282c47 100644
--- a/lemmy_utils/src/request.rs
+++ b/lemmy_utils/src/request.rs
@@ -58,7 +58,7 @@ pub(crate) async fn fetch_iframely(
   client: &Client,
   url: &str,
 ) -> Result<IframelyResponse, LemmyError> {
-  let fetch_url = format!("http://iframely/oembed?url={}", url);
+  let fetch_url = format!("{}/oembed?url={}", Settings::get().iframely_url, url);
 
   let response = retry(|| client.get(&fetch_url).send()).await?;
 
diff --git a/lemmy_utils/src/settings.rs b/lemmy_utils/src/settings.rs
index 797c6fba..3add60b3 100644
--- a/lemmy_utils/src/settings.rs
+++ b/lemmy_utils/src/settings.rs
@@ -15,6 +15,7 @@ pub struct Settings {
   pub tls_enabled: bool,
   pub jwt_secret: String,
   pub pictrs_url: String,
+  pub iframely_url: String,
   pub rate_limit: RateLimitConfig,
   pub email: Option<EmailConfig>,
   pub federation: FederationConfig,