Skip to content

Commit

Permalink
Default to https for LEMMYBB_BACKEND if no protocol given
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Feb 5, 2023
1 parent 8610869 commit a51e916
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ pub fn listen_address() -> String {

/// Address where Lemmy API is available.
pub fn lemmy_backend() -> String {
std::env::var("LEMMYBB_BACKEND").unwrap_or_else(|_| "http://localhost:8536".to_string())
let mut backend =
std::env::var("LEMMYBB_BACKEND").unwrap_or_else(|_| "http://localhost:8536".to_string());
if !backend.starts_with("http://") && !backend.starts_with("https://") {
backend = format!("https://{backend}");
}
backend
}

/// Set true if Lemmy backend runs with increased message rate limit. This is necessary to show
Expand Down

0 comments on commit a51e916

Please sign in to comment.