mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-08-01 17:38:36 +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 {
|
||||
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?)
|
||||
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());
|
||||
|
||||
let config = raw_config
|
||||
.extract::<Config>()
|
||||
.expect("It looks like your config is invalid. Please take a look at the error")
|
||||
.fallbacks();
|
||||
std::env::set_var("RUST_LOG", "warn");
|
||||
|
||||
let db = Database::load_or_create(config.clone())
|
||||
.await
|
||||
.expect("config is valid");
|
||||
let mut config = raw_config
|
||||
.extract::<Config>()
|
||||
.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 {
|
||||
let (tracer, _uninstall) = opentelemetry_jaeger::new_pipeline()
|
||||
|
@ -211,18 +211,22 @@ async fn main() {
|
|||
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
||||
Registry::default().with(telemetry).try_init().unwrap();
|
||||
|
||||
let root = span!(tracing::Level::INFO, "app_start", work_units = 2);
|
||||
let _enter = root.enter();
|
||||
|
||||
let rocket = setup_rocket(raw_config, db);
|
||||
rocket.launch().await.unwrap();
|
||||
_span = Some(span!(tracing::Level::INFO, "app_start", work_units = 2));
|
||||
_enter = Some(_span.as_ref().unwrap().enter());
|
||||
} else {
|
||||
std::env::set_var("RUST_LOG", config.log);
|
||||
std::env::set_var("RUST_LOG", &config.log);
|
||||
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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue