Añade un rótulo opcional al arrancar la aplicación

This commit is contained in:
Manuel Cillero 2022-02-14 19:36:16 +01:00
parent 24e773c17b
commit 5d2901d32a
8 changed files with 4444 additions and 9 deletions

View file

@ -12,6 +12,24 @@ pub fn run(bootstrap: Option<fn()>) -> Result<Server, std::io::Error> {
// Al ser el último, puede sobrecargarse en la función de arranque.
register_module(&base::module::homepage::HomepageModule);
// Si el arranque ha ido bien imprime un rótulo opcional de bienvenida.
if SETTINGS.app.startup_banner.to_lowercase() != "off" {
let figfont = figlet_rs::FIGfont::from_content(
match SETTINGS.app.startup_banner.to_lowercase().as_str() {
"slant" => include_str!("../../../resources/slant.flf"),
"small" => include_str!("../../../resources/small.flf"),
"speed" => include_str!("../../../resources/speed.flf"),
"starwars" => include_str!("../../../resources/starwars.flf"),
_ => include_str!("../../../resources/small.flf")
}
).unwrap();
println!("\n{} {}\n\n Powered by PageTop {}\n",
figfont.convert(&SETTINGS.app.name).unwrap(),
&SETTINGS.app.description,
env!("CARGO_PKG_VERSION")
);
}
// Inicializa el servidor web.
let server = server::HttpServer::new(|| {
server::App::new()