Configure permissions properly on Rocket.toml. Make static path behave better
This commit is contained in:
@ -6,7 +6,7 @@ mod consts;
|
||||
mod macros;
|
||||
mod routes;
|
||||
|
||||
use std::{collections::HashMap, env};
|
||||
use std::{collections::HashMap, env, path::Path};
|
||||
|
||||
use oauth2::{basic::BasicClient, AuthUrl, ClientId, ClientSecret, RedirectUrl, TokenUrl};
|
||||
use rocket::{
|
||||
@ -88,6 +88,9 @@ pub async fn initialize(
|
||||
|
||||
let reqwest_client = reqwest::Client::new();
|
||||
|
||||
let static_path =
|
||||
if Path::new("web/static").exists() { "web/static" } else { "/lib/reminder-rs/static" };
|
||||
|
||||
rocket::build()
|
||||
.attach(Template::fairing())
|
||||
.register(
|
||||
@ -105,7 +108,7 @@ pub async fn initialize(
|
||||
.manage(reqwest_client)
|
||||
.manage(serenity_context)
|
||||
.manage(db_pool)
|
||||
.mount("/static", FileServer::from("/lib/reminder-rs/static"))
|
||||
.mount("/static", FileServer::from(static_path))
|
||||
.mount(
|
||||
"/",
|
||||
routes![
|
||||
|
Reference in New Issue
Block a user