mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-08-06 17:40:59 +00:00
shuffle main.rs to allow deprecation warnings
This commit is contained in:
parent
6e8beb604d
commit
7e0aab7852
2 changed files with 21 additions and 18 deletions
|
@ -90,10 +90,9 @@ macro_rules! deprecate_with {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn fallbacks(mut self) -> Self {
|
pub fn process_fallbacks(&mut self) {
|
||||||
// TODO: have a proper way handle into above struct (maybe serde supports something like this?)
|
// TODO: have a proper way handle into above struct (maybe serde supports something like this?)
|
||||||
deprecate_with!(self ; cache_capacity -> db_cache_capacity or default_db_cache_capacity);
|
deprecate_with!(self ; cache_capacity -> db_cache_capacity or default_db_cache_capacity);
|
||||||
self
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
src/main.rs
36
src/main.rs
|
@ -194,14 +194,14 @@ async fn main() {
|
||||||
)
|
)
|
||||||
.merge(Env::prefixed("CONDUIT_").global());
|
.merge(Env::prefixed("CONDUIT_").global());
|
||||||
|
|
||||||
let config = raw_config
|
std::env::set_var("RUST_LOG", "warn");
|
||||||
.extract::<Config>()
|
|
||||||
.expect("It looks like your config is invalid. Please take a look at the error")
|
|
||||||
.fallbacks();
|
|
||||||
|
|
||||||
let db = Database::load_or_create(config.clone())
|
let mut config = raw_config
|
||||||
.await
|
.extract::<Config>()
|
||||||
.expect("config is valid");
|
.expect("It looks like your config is invalid. Please take a look at the error");
|
||||||
|
|
||||||
|
let mut _span: Option<span::Span> = None;
|
||||||
|
let mut _enter: Option<span::Entered<'_>> = None;
|
||||||
|
|
||||||
if config.allow_jaeger {
|
if config.allow_jaeger {
|
||||||
let (tracer, _uninstall) = opentelemetry_jaeger::new_pipeline()
|
let (tracer, _uninstall) = opentelemetry_jaeger::new_pipeline()
|
||||||
|
@ -211,18 +211,22 @@ async fn main() {
|
||||||
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
||||||
Registry::default().with(telemetry).try_init().unwrap();
|
Registry::default().with(telemetry).try_init().unwrap();
|
||||||
|
|
||||||
let root = span!(tracing::Level::INFO, "app_start", work_units = 2);
|
_span = Some(span!(tracing::Level::INFO, "app_start", work_units = 2));
|
||||||
let _enter = root.enter();
|
_enter = Some(_span.as_ref().unwrap().enter());
|
||||||
|
|
||||||
let rocket = setup_rocket(raw_config, db);
|
|
||||||
rocket.launch().await.unwrap();
|
|
||||||
} else {
|
} else {
|
||||||
std::env::set_var("RUST_LOG", config.log);
|
std::env::set_var("RUST_LOG", &config.log);
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
let rocket = setup_rocket(raw_config, db);
|
|
||||||
rocket.launch().await.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Required here to process fallbacks while logging is enabled, but before config is actually used for anything
|
||||||
|
config.process_fallbacks();
|
||||||
|
|
||||||
|
let db = Database::load_or_create(config)
|
||||||
|
.await
|
||||||
|
.expect("config is valid");
|
||||||
|
|
||||||
|
let rocket = setup_rocket(raw_config, db);
|
||||||
|
rocket.launch().await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[catch(404)]
|
#[catch(404)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue