i wanna use a reverse proxy anyways

This commit is contained in:
Leonard Lorenz 2020-10-23 01:03:59 +02:00
parent e69dc686f0
commit 19080cc0e7
5 changed files with 2 additions and 64 deletions

View file

@ -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)

43
site/Cargo.lock generated
View file

@ -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",

View file

@ -21,5 +21,3 @@ diesel_codegen = { version = "*", default-features = false }
uuid = { version = "*", features = ["serde", "v5"] }
tera = "*"
openssl = "*"

View file

@ -24,11 +24,11 @@ pub fn get_posts() -> std::vec::Vec<Post> {
.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")
}

View file

@ -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())