From 19080cc0e746f8d9a5583ebd27d5a2ca4a69e193 Mon Sep 17 00:00:00 2001 From: Leonard Lorenz Date: Fri, 23 Oct 2020 01:03:59 +0200 Subject: [PATCH] i wanna use a reverse proxy anyways --- doc/environment.md | 3 --- site/Cargo.lock | 43 ------------------------------------------- site/Cargo.toml | 2 -- site/src/db.rs | 4 ++-- site/src/main.rs | 14 -------------- 5 files changed, 2 insertions(+), 64 deletions(-) diff --git a/doc/environment.md b/doc/environment.md index af6e49f..72bf7a4 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -2,7 +2,4 @@ - SUBMIT_TOKEN: Alphanumeric string to be used for creating blog posts - ROOT_PATH: path where html, static and database reside -- SSL_PATH: path to SSL certificates containing key.pem and cert.pem - BIND_PORT: port to bind to -- SSL_PRIV_NAME: private key for the certificate -- SSL_CERT_NAME: public key for the certificate (fullchain) diff --git a/site/Cargo.lock b/site/Cargo.lock index 53a28c1..5f997aa 100644 --- a/site/Cargo.lock +++ b/site/Cargo.lock @@ -727,21 +727,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1299,33 +1284,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4" -dependencies = [ - "bitflags", - "cfg-if 0.1.10", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", -] - -[[package]] -name = "openssl-sys" -version = "0.9.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parking_lot" version = "0.11.0" @@ -1580,7 +1538,6 @@ dependencies = [ "chrono", "diesel 1.4.5", "diesel_codegen", - "openssl", "serde", "serde_derive", "serde_json", diff --git a/site/Cargo.toml b/site/Cargo.toml index 96e32fe..d8ae533 100644 --- a/site/Cargo.toml +++ b/site/Cargo.toml @@ -21,5 +21,3 @@ diesel_codegen = { version = "*", default-features = false } uuid = { version = "*", features = ["serde", "v5"] } tera = "*" - -openssl = "*" diff --git a/site/src/db.rs b/site/src/db.rs index 0e94219..87dfb7a 100644 --- a/site/src/db.rs +++ b/site/src/db.rs @@ -24,11 +24,11 @@ pub fn get_posts() -> std::vec::Vec { .expect("Error, couldn't load posts.") } -pub fn get_post_by_id(id: i32) -> Post { +pub fn get_post_by_id(_id: i32) -> Post { use crate::db::schema::posts::dsl::*; let connection = establish_connection(); posts - .find(id) + .find(_id) .get_result(&connection) .expect("Error, couldn't find post") } diff --git a/site/src/main.rs b/site/src/main.rs index 8d39ef0..05e917e 100644 --- a/site/src/main.rs +++ b/site/src/main.rs @@ -11,25 +11,11 @@ extern crate tera; use actix_files as fs; use actix_web::{App, HttpServer}; use config::get_from_env; -use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { let root_path = get_from_env("ROOT_PATH", true); - let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap(); - builder - .set_private_key_file( - get_from_env("SSL_PATH", true) + &get_from_env("SSL_PRIV_NAME", true), - SslFiletype::PEM, - ) - .unwrap(); - - builder - .set_certificate_chain_file( - get_from_env("SSL_PATH", true) + &get_from_env("SSL_CERT_NAME", true), - ) - .unwrap(); App::new() //.wrap(middleware::NormalizePath::default())