Skip to content

Commit bb12eeb

Browse files
committed
Add node_url field to Cli struct and update related code
1 parent 01eb76c commit bb12eeb

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

server/src/cli.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ pub struct Cli {
8686

8787
/// Mode of operation
8888
pub mode: Mode,
89+
90+
/// public address for the parseable server
91+
pub node_url: String,
8992
}
9093

9194
impl Cli {
@@ -112,6 +115,7 @@ impl Cli {
112115
pub const ROW_GROUP_SIZE: &'static str = "row-group-size";
113116
pub const PARQUET_COMPRESSION_ALGO: &'static str = "compression-algo";
114117
pub const MODE: &'static str = "mode";
118+
pub const NODE_URL: &'static str = "node-url";
115119
pub const DEFAULT_USERNAME: &'static str = "admin";
116120
pub const DEFAULT_PASSWORD: &'static str = "admin";
117121

@@ -247,7 +251,7 @@ impl Cli {
247251
Arg::new(Self::OPENID_ISSUER)
248252
.long(Self::OPENID_ISSUER)
249253
.env("P_OIDC_ISSUER")
250-
.value_name("URl")
254+
.value_name("URL")
251255
.required(false)
252256
.value_parser(validation::url)
253257
.help("OIDC provider's host address"),
@@ -312,6 +316,15 @@ impl Cli {
312316
"all"])
313317
.help("Mode of operation"),
314318
)
319+
.arg(
320+
Arg::new(Self::NODE_URL)
321+
.long(Self::NODE_URL)
322+
.env("P_NODE_URL")
323+
.value_name("URL")
324+
.required(true)
325+
.value_parser(validation::socket_addr)
326+
.help("Node URL for Parseable server")
327+
)
315328
.arg(
316329
Arg::new(Self::PARQUET_COMPRESSION_ALGO)
317330
.long(Self::PARQUET_COMPRESSION_ALGO)
@@ -354,6 +367,12 @@ impl FromArgMatches for Cli {
354367
.get_one::<String>(Self::ADDRESS)
355368
.cloned()
356369
.expect("default value for address");
370+
371+
self.node_url = m
372+
.get_one::<String>(Self::NODE_URL)
373+
.cloned()
374+
.expect("Node URL set");
375+
357376
self.local_staging_path = m
358377
.get_one::<PathBuf>(Self::STAGING)
359378
.cloned()

server/src/handlers/http/modal/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl Server {
480480
pub fn get_server_address() -> SocketAddr {
481481
// this might cause an issue down the line
482482
// best is to make the Cli Struct better, but thats a chore
483-
(CONFIG.parseable.address.clone())
483+
(CONFIG.parseable.node_url.clone())
484484
.parse::<SocketAddr>()
485485
.unwrap()
486486
}

server/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl TimePeriod {
228228

229229
#[inline(always)]
230230
pub fn get_address() -> (IpAddr, u16) {
231-
let addr = CONFIG.parseable.address.parse::<SocketAddr>().unwrap();
231+
let addr = CONFIG.parseable.node_url.parse::<SocketAddr>().unwrap();
232232
(addr.ip(), addr.port())
233233
}
234234

0 commit comments

Comments
 (0)