Removed list of mounted routes at startup by default, with option to add it back. This would get annoying when starting the server frequently, because it printed ~130 lines of mostly useless info

pull/398/head
Daniel García 6 years ago
parent 0f0a87becf
commit d3773a433a
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A

@ -247,6 +247,8 @@ make_config! {
/// Reload templates (Dev) |> When this is set to true, the templates get reloaded with every request. ONLY use this during development, as it can slow down the server
reload_templates: bool, true, def, false;
/// Log routes at launch (Dev)
log_mounts: bool, true, def, false;
/// Enable extended logging
extended_logging: bool, false, def, true;
/// Log file path

@ -39,18 +39,37 @@ mod util;
pub use config::CONFIG;
fn init_rocket() -> Rocket {
rocket::ignite()
fn launch_rocket() {
// Create Rocket object, this stores current log level and sets it's own
let rocket = rocket::ignite();
// If we aren't logging the mounts, we force the logging level down
if !CONFIG.log_mounts() {
log::set_max_level(log::LevelFilter::Warn);
}
let rocket = rocket
.mount("/", api::web_routes())
.mount("/api", api::core_routes())
.mount("/admin", api::admin_routes())
.mount("/identity", api::identity_routes())
.mount("/icons", api::icons_routes())
.mount("/notifications", api::notifications_routes())
.mount("/notifications", api::notifications_routes());
// Force the level up for the fairings, managed state and lauch
if !CONFIG.log_mounts() {
log::set_max_level(log::LevelFilter::max());
}
let rocket = rocket
.manage(db::init_pool())
.manage(api::start_notification_server())
.attach(util::AppHeaders())
.attach(AdHoc::on_launch("Launch Info", launch_info))
.attach(AdHoc::on_launch("Launch Info", launch_info));
// Launch and print error if there is one
// The launch will restore the original logging level
error!("Launch error {:#?}", rocket.launch());
}
// Embed the migrations from the migrations folder into the application
@ -79,7 +98,7 @@ fn main() {
check_web_vault();
migrations::run_migrations();
init_rocket().launch();
launch_rocket();
}
fn init_logging() -> Result<(), fern::InitError> {

@ -89,9 +89,7 @@
<input class="form-check-input conf-{{type}}" type="checkbox" id="input_{{name}}"
name="{{name}}" {{#if value}} checked {{/if}}>
{{#if default}}
<label class="form-check-label" for="input_{{name}}"> Default: {{default}} </label>
{{/if}}
</div>
</div>
{{/case}}

Loading…
Cancel
Save