Commit 8923ff7d authored by Asone's avatar Asone

fix: ran cargo fmt

parent 80e7da80
......@@ -9,12 +9,12 @@ extern crate juniper;
extern crate juniper_rocket;
#[macro_use]
extern crate rocket;
extern crate dotenv;
extern crate rocket_cors;
extern crate serde;
extern crate serde_json;
extern crate tricoteuses_api_assemblee_config as config;
extern crate tricoteuses_api_assemblee_data as data;
extern crate dotenv;
use chrono::prelude::*;
use clap::{App, Arg};
......@@ -24,14 +24,14 @@ use data::{
Mandat, Organe, Reunion, Scrutin, Statut, TexteLeg, TextesEtAmendements, ALL_DATASETS,
FONCTIONS_ORGANES,
};
use dotenv::dotenv;
use juniper::{EmptyMutation, FieldResult, RootNode};
use rocket::http::Method;
use rocket::response::{content, NamedFile};
use rocket::State;
use rocket_cors::AllowedOrigins;
use std::path::{Path, PathBuf};
use dotenv::dotenv;
use std::env;
use std::path::{Path, PathBuf};
struct Query;
......@@ -590,23 +590,23 @@ fn main() {
// gets allowed_origins from config file
let mut allowed_extended_origins: Vec<String> = config.api.allowed_origins;
// collect allowed origins from dotenv config file
dotenv().ok();
// check if variable is acceptable
let has_additional_allowed_hosts = env::var("ALLOWED_HOSTS").is_ok();
if has_additional_allowed_hosts{
match env::var("ALLOWED_HOSTS"){
if has_additional_allowed_hosts {
match env::var("ALLOWED_HOSTS") {
Ok(hosts_values) => {
let mut hosts: Vec<&str> = hosts_values.split(',').collect();
for host in hosts{
let hosts: Vec<&str> = hosts_values.split(',').collect();
for host in hosts {
allowed_extended_origins.push(host.to_string());
}
},
}
Err(_value) => {
println!("{:?}",_value);
println!("{:?}", _value);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment