Skip to content

Commit ca9e65e

Browse files
author
Gor Stepanyan
committed
examples: get config path as command line arg in cloud example
1 parent 5899fdf commit ca9e65e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/cloud.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::env;
12
use std::path::Path;
23

34
use anyhow::Result;
@@ -6,8 +7,10 @@ use scylla::CloudSessionBuilder;
67
#[tokio::main]
78
async fn main() -> Result<()> {
89
println!("Connecting to SNI proxy as described in cloud config yaml ...");
9-
10-
let session = CloudSessionBuilder::new(Path::new("examples/config_data.yaml"))
10+
let config_path = env::args()
11+
.nth(1)
12+
.unwrap_or("examples/config_data.yaml".to_owned());
13+
let session = CloudSessionBuilder::new(Path::new(&config_path))
1114
.unwrap()
1215
.build()
1316
.await

0 commit comments

Comments
 (0)