geforkt von mirrored/vaultwarden
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
Dieser Commit ist enthalten in:
Ursprung
0f0a87becf
Commit
d3773a433a
3 geänderte Dateien mit 26 neuen und 7 gelöschten Zeilen
|
@ -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 (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;
|
reload_templates: bool, true, def, false;
|
||||||
|
|
||||||
|
/// Log routes at launch (Dev)
|
||||||
|
log_mounts: bool, true, def, false;
|
||||||
/// Enable extended logging
|
/// Enable extended logging
|
||||||
extended_logging: bool, false, def, true;
|
extended_logging: bool, false, def, true;
|
||||||
/// Log file path
|
/// Log file path
|
||||||
|
|
29
src/main.rs
29
src/main.rs
|
@ -39,18 +39,37 @@ mod util;
|
||||||
|
|
||||||
pub use config::CONFIG;
|
pub use config::CONFIG;
|
||||||
|
|
||||||
fn init_rocket() -> Rocket {
|
fn launch_rocket() {
|
||||||
rocket::ignite()
|
// 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::web_routes())
|
||||||
.mount("/api", api::core_routes())
|
.mount("/api", api::core_routes())
|
||||||
.mount("/admin", api::admin_routes())
|
.mount("/admin", api::admin_routes())
|
||||||
.mount("/identity", api::identity_routes())
|
.mount("/identity", api::identity_routes())
|
||||||
.mount("/icons", api::icons_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(db::init_pool())
|
||||||
.manage(api::start_notification_server())
|
.manage(api::start_notification_server())
|
||||||
.attach(util::AppHeaders())
|
.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
|
// Embed the migrations from the migrations folder into the application
|
||||||
|
@ -79,7 +98,7 @@ fn main() {
|
||||||
check_web_vault();
|
check_web_vault();
|
||||||
migrations::run_migrations();
|
migrations::run_migrations();
|
||||||
|
|
||||||
init_rocket().launch();
|
launch_rocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init_logging() -> Result<(), fern::InitError> {
|
fn init_logging() -> Result<(), fern::InitError> {
|
||||||
|
|
|
@ -89,9 +89,7 @@
|
||||||
<input class="form-check-input conf-{{type}}" type="checkbox" id="input_{{name}}"
|
<input class="form-check-input conf-{{type}}" type="checkbox" id="input_{{name}}"
|
||||||
name="{{name}}" {{#if value}} checked {{/if}}>
|
name="{{name}}" {{#if value}} checked {{/if}}>
|
||||||
|
|
||||||
{{#if default}}
|
|
||||||
<label class="form-check-label" for="input_{{name}}"> Default: {{default}} </label>
|
<label class="form-check-label" for="input_{{name}}"> Default: {{default}} </label>
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/case}}
|
{{/case}}
|
||||||
|
|
Laden …
In neuem Issue referenzieren