File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,18 +26,23 @@ static GLOBAL: MiMalloc = MiMalloc;
2626#[ derive( Parser , Debug ) ]
2727#[ command( version, about, long_about = None ) ]
2828struct CliArgs {
29- config : PathBuf ,
29+ /// Path to the configuration file (positional argument)
30+ config_file : Option < PathBuf > ,
31+ /// Path to the configuration file (flag variant)
32+ #[ arg( short, long, hide = true ) ]
33+ config : Option < PathBuf > ,
3034}
3135
3236#[ tokio:: main( flavor = "current_thread" ) ]
3337async fn main ( ) {
3438 let args = CliArgs :: parse ( ) ;
3539
36- println ! ( "[~] Loading config from {}..." , args. config. display( ) ) ;
37- config:: init ( if args. config . exists ( ) {
38- Config :: from_file ( & args. config ) . unwrap_or_else ( |e| panic ! ( "[!] Failed to load config file: {e:?}" ) )
40+ let config_path = args. config_file . or ( args. config ) . expect ( "[!] Config file path must be provided." ) ;
41+ println ! ( "[~] Loading config from {}..." , config_path. display( ) ) ;
42+ config:: init ( if config_path. exists ( ) {
43+ Config :: from_file ( & config_path) . unwrap_or_else ( |e| panic ! ( "[!] Failed to load config file: {e:?}" ) )
3944 } else {
40- panic ! ( "[!] Config file not found: {}" , args . config . display( ) ) ;
45+ panic ! ( "[!] Config file not found: {}" , config_path . display( ) ) ;
4146 } ) ;
4247
4348 if let Err ( err) = utils:: increase_nofile_limit ( config:: get ( ) . network_worker . total_connections * 10 ) {
You can’t perform that action at this time.
0 commit comments