How can I read the Rocket.toml? #1909
Answered
by
zemelLeong
zemelLeong
asked this question in
Questions
-
I read version info: rocket::build()
.manage(es_client)
.attach(database::MysqlDBConn::fairing())
.attach(fairing::CORS)
.attach(AdHoc::on_liftoff("nacos", |rocket| {
let figment = rocket.figment();
println!("{:?}", figment.extract_inner::<String>("nacos"));
Box::pin(async move {
tokio::spawn(async move {
let mut interval = tokio::time::interval(Duration::from_secs(5));
loop {
interval.tick().await;
println!("@@@@@@@@@@@@@@@@@@@@");
}
});
})
})) [global.databases]
mysql = { url = "mysql://root:root@localhost:3306/rocket_document_manager" }
# [nacos]
nacos = "localhost:8848"
|
Beta Was this translation helpful? Give feedback.
Answered by
zemelLeong
Sep 19, 2021
Replies: 1 comment 1 reply
-
use |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zemelLeong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use
figment.find_value("databases");
to access the config.