take static path from environment
This commit is contained in:
parent
b1e749d3a6
commit
fa45a890ad
4
.env
4
.env
@ -1,4 +1,6 @@
|
|||||||
DATABASE_URL="sqlite://terminwahl_back/db.sqlite"
|
DATABASE_URL="sqlite://terminwahl_back/db.sqlite"
|
||||||
RUST_LOG="debug"
|
RUST_LOG="debug"
|
||||||
SMTP_USER="SMTP_USERNAME"
|
SMTP_USER="SMTP_USERNAME"
|
||||||
SMTP_PASSWORD="SMTP_PASSWORD"
|
SMTP_PASSWORD="SMTP_PASSWORD"
|
||||||
|
|
||||||
|
PATH_TO_STATICS="terminwahl_front/dist/"
|
||||||
|
@ -24,6 +24,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.expect("Failed to create pool");
|
.expect("Failed to create pool");
|
||||||
let smtp_user = env::var("SMTP_USER").expect("Failed to get smtp user");
|
let smtp_user = env::var("SMTP_USER").expect("Failed to get smtp user");
|
||||||
let smtp_password = env::var("SMTP_PASSWORD").expect("Failed to get smtp password");
|
let smtp_password = env::var("SMTP_PASSWORD").expect("Failed to get smtp password");
|
||||||
|
let wasm_statics = env::var("PATH_TO_STATICS").expect("Failed to get statics path");
|
||||||
let credentials = Credentials::new(smtp_user, smtp_password);
|
let credentials = Credentials::new(smtp_user, smtp_password);
|
||||||
let smtp_pool = SmtpTransport::relay("smtp.1und1.de")
|
let smtp_pool = SmtpTransport::relay("smtp.1und1.de")
|
||||||
.expect("Failed to connect to smtp")
|
.expect("Failed to connect to smtp")
|
||||||
@ -85,7 +86,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
web::resource("/cancel/{teacher_id}/{slot_id}/{validation_key}")
|
web::resource("/cancel/{teacher_id}/{slot_id}/{validation_key}")
|
||||||
.route(web::get().to(views::delete_appointment)),
|
.route(web::get().to(views::delete_appointment)),
|
||||||
)
|
)
|
||||||
.service(Files::new("/", "./terminwahl_front/dist/").index_file("index.html"))
|
.service(Files::new("/", wasm_statics.clone()).index_file("index.html"))
|
||||||
})
|
})
|
||||||
.bind(("127.0.0.1", 8080))?
|
.bind(("127.0.0.1", 8080))?
|
||||||
.workers(2)
|
.workers(2)
|
||||||
|
Loading…
Reference in New Issue
Block a user