diff --git a/src/bin/server.rs b/src/bin/server.rs index 20db345e12c..7fe649038a8 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -5,7 +5,7 @@ extern crate tracing; use crates_io::middleware::normalize_path::normalize_path; use crates_io::{metrics::LogEncoder, util::errors::AppResult, App}; -use std::{fs::File, process::Command, sync::Arc, time::Duration}; +use std::{sync::Arc, time::Duration}; use axum::ServiceExt; use futures_util::future::FutureExt; @@ -80,21 +80,6 @@ fn main() -> Result<(), Box> { // the test suite :) info!("Listening at http://{addr}"); - // Creating this file tells heroku to tell nginx that the application is ready - // to receive traffic. - if app.config.use_nginx_wrapper { - let path = "/tmp/app-initialized"; - info!("Writing to {path}"); - File::create(path).unwrap(); - - // Launch nginx via the Heroku nginx buildpack - // `wait()` is never called on the child process, but it should be okay to leave a zombie - // process around on shutdown when Heroku is tearing down the entire container anyway. - Command::new("./script/start-web.sh") - .spawn() - .expect("Couldn't spawn nginx"); - } - // Block the main thread until the server has shutdown rt.block_on(server)?; diff --git a/src/config/server.rs b/src/config/server.rs index 7add05d197b..5ceeb24cae0 100644 --- a/src/config/server.rs +++ b/src/config/server.rs @@ -26,7 +26,6 @@ pub struct Server { pub ip: IpAddr, pub port: u16, pub max_blocking_threads: Option, - pub use_nginx_wrapper: bool, pub db: DatabasePools, pub storage: StorageConfig, pub session_key: cookie::Key, @@ -105,20 +104,15 @@ impl Default for Server { /// This function panics if the Server configuration is invalid. fn default() -> Self { let docker = dotenvy::var("DEV_DOCKER").is_ok(); - let heroku = dotenvy::var("HEROKU").is_ok(); - let use_nginx_wrapper = heroku && dotenvy::var("USE_NGINX").unwrap_or_default() != "n"; - let ip = if (heroku && !use_nginx_wrapper) || docker { + let ip = if heroku || docker { [0, 0, 0, 0].into() } else { [127, 0, 0, 1].into() }; - let port = match (use_nginx_wrapper, env_optional("PORT")) { - (false, Some(port)) => port, - _ => 8888, - }; + let port = env_optional("PORT").unwrap_or(8888); let allowed_origins = AllowedOrigins::from_default_env(); let page_offset_ua_blocklist = match env_optional::("WEB_PAGE_OFFSET_UA_BLOCKLIST") @@ -189,7 +183,6 @@ impl Default for Server { ip, port, max_blocking_threads, - use_nginx_wrapper, session_key: cookie::Key::derive_from(env("SESSION_KEY").as_bytes()), gh_client_id: ClientId::new(env("GH_CLIENT_ID")), gh_client_secret: ClientSecret::new(env("GH_CLIENT_SECRET")), diff --git a/src/tests/util/test_app.rs b/src/tests/util/test_app.rs index f2849181f61..613ef18a7ac 100644 --- a/src/tests/util/test_app.rs +++ b/src/tests/util/test_app.rs @@ -400,7 +400,6 @@ fn simple_config() -> config::Server { ip: [127, 0, 0, 1].into(), port: 8888, max_blocking_threads: None, - use_nginx_wrapper: false, db, storage, session_key: cookie::Key::derive_from("test this has to be over 32 bytes long".as_bytes()),