Remove last unwrap from ordabok
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
233ea7c416
commit
51f0fc3108
14
src/main.rs
14
src/main.rs
@ -4,7 +4,7 @@ mod appwrite;
|
|||||||
mod db;
|
mod db;
|
||||||
mod graphql;
|
mod graphql;
|
||||||
|
|
||||||
use std::{env, error::Error};
|
use std::{collections::HashSet, env, error::Error};
|
||||||
|
|
||||||
use dotenvy::dotenv;
|
use dotenvy::dotenv;
|
||||||
use tracing::{debug, info, Level};
|
use tracing::{debug, info, Level};
|
||||||
@ -19,13 +19,13 @@ fn setup_logging() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make_cors() -> Result<rocket_cors::Cors, rocket_cors::Error> {
|
fn make_cors() -> Result<rocket_cors::Cors, rocket_cors::Error> {
|
||||||
use rocket_cors::{AllowedHeaders, AllowedOrigins};
|
use rocket::http::Method as HMethod;
|
||||||
use std::str::FromStr;
|
use rocket_cors::{AllowedHeaders, AllowedOrigins, Method};
|
||||||
rocket_cors::CorsOptions {
|
rocket_cors::CorsOptions {
|
||||||
allowed_methods: ["Get", "Post"]
|
allowed_methods: HashSet::from([
|
||||||
.iter()
|
Method::from(HMethod::Get),
|
||||||
.map(|s| FromStr::from_str(s).unwrap())
|
Method::from(HMethod::Post),
|
||||||
.collect(),
|
]),
|
||||||
allowed_headers: AllowedHeaders::some(&["Authorization", "Accept"]),
|
allowed_headers: AllowedHeaders::some(&["Authorization", "Accept"]),
|
||||||
allowed_origins: match env::var("ORDABOK_HOSTS") {
|
allowed_origins: match env::var("ORDABOK_HOSTS") {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user