feat: cors
This commit is contained in:
@@ -3,6 +3,8 @@ MAST_CLIENT="<your client id>"
|
||||
MAST_SECRET="<your client key>"
|
||||
MAST_SCOPE="read:accounts"
|
||||
|
||||
FRONTEND_WHITELIST="https://hole-thu.github.io"
|
||||
|
||||
DATABASE_URL="postgres://hole:hole_pass@localhost/hole_v2"
|
||||
MIGRATION_DIRECTORY=migrations/postgres
|
||||
REDIS_URL="redis://127.0.0.1:6379"
|
||||
|
||||
@@ -12,6 +12,7 @@ extern crate log;
|
||||
|
||||
mod api;
|
||||
mod cache;
|
||||
mod cors;
|
||||
mod db_conn;
|
||||
mod libs;
|
||||
#[cfg(feature = "mastlogin")]
|
||||
@@ -98,6 +99,13 @@ async fn main() -> Result<(), rocket::Error> {
|
||||
.manage(RandomHasher::get_random_one())
|
||||
.manage(rmc)
|
||||
.attach(Db::fairing())
|
||||
.attach(cors::CORS {
|
||||
whitelist: env::var("FRONTEND_WHITELIST")
|
||||
.unwrap_or_default()
|
||||
.split(',')
|
||||
.map(|s| s.to_string())
|
||||
.collect::<Vec<String>>(),
|
||||
})
|
||||
.launch()
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user