Skip to content

Commit 361f225

Browse files
committed
[ISSUE #36]Support current dir as rocketmq home
1 parent ddbdac8 commit 361f225

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

rocketmq-namesrv/src/bin/bootstrap_server.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@
1515
* limitations under the License.
1616
*/
1717

18-
use std::{collections::HashMap, process::exit};
18+
use std::{collections::HashMap, path::PathBuf};
1919

2020
use clap::Parser;
2121
use namesrv::processor::default_request_processor::DefaultRequestProcessor;
2222
use rocketmq_remoting::runtime::server;
2323
use tokio::net::TcpListener;
24-
use tracing::{error, info};
24+
use tracing::info;
2525

2626
#[rocketmq::main]
2727
async fn main() -> anyhow::Result<()> {
2828
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-
}
3729
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);
3838
info!(
3939
"Rocketmq name server(Rust) running on {}:{}",
4040
args.ip, args.port
@@ -80,7 +80,7 @@ struct Args {
8080
required = false
8181
)]
8282
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>,
8686
}

0 commit comments

Comments
 (0)