Skip to content
Snippets Groups Projects
Commit aed15c62 authored by Fernando K's avatar Fernando K
Browse files

Make BASE_URL work

parent 17e6add4
No related branches found
No related tags found
No related merge requests found
......@@ -2,4 +2,4 @@ DATABASE_URL=postgresql://jughisto@database/jughisto
SECRET_HASH_KEY=rhdFVrOAq/wEyVw9MsmV8MSvGBj0AotAUTHs2yEs+zBlvcMRsfflUc73WgY30SRpH4Djvr60IXhM71MRiLUu9g==
IDENTITY_SECRET_KEY=Ltg58gY6DD/g0+P+Jl5s5W24qA4R6gM19mE/6rQEGEm9VGlY7DqGEeEuEc1leOeyLdgUPa+cNZ7NigPu7de8LA==
TZ=America/Sao_Paulo
BASE_URL=/jughisto/
BASE_URL=
......@@ -195,7 +195,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
.app_data(broadcaster.clone())
.app_data(handlebars_ref.clone())
.service(
web::scope("/jughisto")
web::scope(&env::var("BASE_URL").expect("BASE_URL variable is not set"))
.service(pages::get_login::get_login)
.service(pages::get_me::get_me)
.service(pages::change_password::change_password)
......
......@@ -152,7 +152,7 @@ pub fn redirect_to_referer(message: String, request: &HttpRequest) -> HttpRespon
.get("Referer")
.and_then(|h| h.to_str().ok())
.map_or_else(
|| env::var("BASE_URL").expect("BASE_URL environment variable is not set"),
|| env::var("BASE_URL").expect("BASE_URL environment variable is not set") + "/",
std::convert::Into::into,
);
FlashMessage::info(message).send();
......@@ -166,7 +166,7 @@ pub fn redirect_to_root() -> HttpResponse {
.append_header((
header::LOCATION,
HeaderValue::from_str(
&env::var("BASE_URL").expect("BASE_URL environment variable is not set"),
&(env::var("BASE_URL").expect("BASE_URL environment variable is not set") + "/"),
)
.unwrap(),
))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment