Print config on attach in config example.

This commit is contained in:
Sergio Benitez 2021-03-10 03:37:03 -08:00
parent 3c25326917
commit 015438a780
1 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,15 @@
#[cfg(test)] mod tests;
// This example's illustration is the Rocket.toml file.
use rocket::fairing::AdHoc;
// This example's illustration is the Rocket.toml file. Running this server will
// print the config, however.
#[rocket::launch]
fn rocket() -> rocket::Rocket { rocket::ignite() }
fn rocket() -> rocket::Rocket {
rocket::ignite()
.attach(AdHoc::on_attach("Config Reader", |rocket| async {
let value = rocket.figment().find_value("").unwrap();
println!("{:#?}", value);
Ok(rocket)
}))
}