This repository was archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathmain.rs
74 lines (61 loc) · 1.55 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#![feature(async_closure, proc_macro_hygiene, decl_macro, option_result_contains)]
#![deny(unused_must_use)]
extern crate log;
extern crate semver;
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
extern crate dotenv;
#[doc(hidden)]
#[macro_use]
pub mod macros;
#[doc(hidden)]
mod cache;
#[doc(hidden)]
mod config;
/// Models exposed by this service
///
/// *Important:* Names, Enums and Polymorphism
///
/// Every field in the structs that you will see in this documentation is **camelCased** on serialisation.
///
/// Enums are **SCREAMING_SNAKE_CASED** on serialization and the variant is always put into a `type` json field for polymorphic cases.
mod models;
#[doc(hidden)]
mod monitoring;
#[doc(hidden)]
mod providers;
/// Collection of all endpoints all endpoints
mod routes;
#[doc(hidden)]
mod services;
#[doc(hidden)]
mod utils;
#[cfg(test)]
mod json;
use crate::routes::error_catchers;
use cache::redis::create_pool;
use dotenv::dotenv;
use routes::active_routes;
use std::time::Duration;
use utils::cors::CORS;
#[doc(hidden)]
#[launch]
fn rocket() -> _ {
dotenv().ok();
env_logger::init();
let client = reqwest::Client::builder()
.connect_timeout(Duration::from_millis(
config::internal_client_connect_timeout(),
))
.build()
.unwrap();
rocket::build()
.mount("/", active_routes())
.register("/", error_catchers())
.manage(create_pool())
.manage(client)
.attach(monitoring::performance::PerformanceMonitor())
.attach(CORS())
}