|
15 | 15 | * limitations under the License.
|
16 | 16 | */
|
17 | 17 |
|
18 |
| -use std::{collections::HashMap, process::exit}; |
| 18 | +use std::{collections::HashMap, path::PathBuf}; |
19 | 19 |
|
20 | 20 | use clap::Parser;
|
21 | 21 | use namesrv::processor::default_request_processor::DefaultRequestProcessor;
|
22 | 22 | use rocketmq_remoting::runtime::server;
|
23 | 23 | use tokio::net::TcpListener;
|
24 |
| -use tracing::{error, info}; |
| 24 | +use tracing::info; |
25 | 25 |
|
26 | 26 | #[rocketmq::main]
|
27 | 27 | async fn main() -> anyhow::Result<()> {
|
28 | 28 | rocketmq_common::log::init_logger();
|
29 |
| - let home = std::env::var("ROCKETMQ_HOME"); |
30 |
| - if home.is_err() { |
31 |
| - error!( |
32 |
| - "Please set the ROCKETMQ_HOME variable in your environment to match the location of \ |
33 |
| - the RocketMQ installation" |
34 |
| - ); |
35 |
| - exit(0); |
36 |
| - } |
37 | 29 | let args = Args::parse();
|
| 30 | + let home = std::env::var("ROCKETMQ_HOME").unwrap_or( |
| 31 | + std::env::current_dir() |
| 32 | + .unwrap() |
| 33 | + .into_os_string() |
| 34 | + .to_string_lossy() |
| 35 | + .to_string(), |
| 36 | + ); |
| 37 | + info!("rocketmq home: {}", home); |
38 | 38 | info!(
|
39 | 39 | "Rocketmq name server(Rust) running on {}:{}",
|
40 | 40 | args.ip, args.port
|
@@ -80,7 +80,7 @@ struct Args {
|
80 | 80 | required = false
|
81 | 81 | )]
|
82 | 82 | ip: String,
|
83 |
| - /* /// rocketmq name server config file |
84 |
| - #[arg(short, long, value_name = "FILE")] |
85 |
| - config: Option<PathBuf>,*/ |
| 83 | + /// rocketmq name server config file |
| 84 | + #[arg(short, long, value_name = "FILE", default_missing_value = "None")] |
| 85 | + config: Option<PathBuf>, |
86 | 86 | }
|
0 commit comments