@@ -2,7 +2,7 @@ extern crate rocket;
22
33use chrono:: { self , NaiveDateTime , Timelike } ;
44use chrono:: { DateTime , Datelike , FixedOffset } ;
5- use clap:: { Parser , crate_authors } ;
5+ use clap:: { CommandFactory , Parser } ;
66use config_file:: FromConfigFile ;
77use core:: str;
88use log:: { debug, error, info, trace, warn} ;
@@ -237,7 +237,7 @@ async fn upload(
237237 ocsp:: common:: ocsp:: OcspExt :: Nonce { nonce } => Some ( nonce. len ( ) ) ,
238238 _ => None ,
239239 } )
240- . last ( )
240+ . next_back ( )
241241 } ) {
242242 Some ( 1 ..128 ) | None => ( ) ,
243243 _ => {
@@ -476,17 +476,25 @@ fn rocket() -> rocket::Rocket<rocket::Build> {
476476 let config_path = & cli. config_path ;
477477
478478 if !Path :: new ( config_path) . exists ( ) {
479- panic ! ( "Config file not found at: {}" , config_path. display( ) ) ;
479+ eprintln ! ( "Error: Config file not found at: {}" , config_path) ;
480+ eprintln ! ( "\n Usage information:" ) ;
481+ let mut cli_command = Cli :: command ( ) ;
482+ if let Err ( err) = cli_command. print_help ( ) {
483+ eprintln ! ( "Could not display help: {}" , err) ;
484+ }
485+ std:: process:: exit ( 1 ) ;
480486 }
481487
482488 let config = match Fileconfig :: from_config_file ( config_path) {
483489 Ok ( config) => config,
484490 Err ( e) => {
485- panic ! (
486- "Error reading config file at {}: {}" ,
487- config_path. display( ) ,
488- e
489- ) ;
491+ eprintln ! ( "Error: Reading config file at {}: {}" , config_path, e) ;
492+ eprintln ! ( "\n Usage information:" ) ;
493+ let mut cli_command = Cli :: command ( ) ;
494+ if let Err ( err) = cli_command. print_help ( ) {
495+ eprintln ! ( "Could not display help: {}" , err) ;
496+ }
497+ std:: process:: exit ( 1 ) ;
490498 }
491499 } ;
492500 let cert_raw = match File :: open ( & config. itcert ) {
@@ -562,6 +570,7 @@ fn rocket() -> rocket::Rocket<rocket::Build> {
562570 . clone ( )
563571 . unwrap_or_else ( || DEFAULT_LISTEN_IP . to_string ( ) ) ;
564572
573+
565574 // Determine database type and default port
566575 let db_type = config
567576 . db_type
0 commit comments