16
16
*
17
17
*/
18
18
19
+ use clap:: Parser ;
19
20
use crossterm:: style:: Stylize ;
20
21
use std:: path:: PathBuf ;
21
22
use std:: sync:: Arc ;
22
- use structopt:: StructOpt ;
23
23
24
24
use crate :: banner;
25
25
use crate :: s3:: S3Config ;
@@ -28,7 +28,7 @@ use crate::storage::{ObjectStorage, ObjectStorageError, LOCAL_SYNC_INTERVAL};
28
28
lazy_static:: lazy_static! {
29
29
#[ derive( Debug ) ]
30
30
pub static ref CONFIG : Arc <Config > = {
31
- let storage = Box :: new( S3Config :: from_args ( ) ) ;
31
+ let storage = Box :: new( S3Config :: parse ( ) ) ;
32
32
Arc :: new( Config :: new( storage) )
33
33
} ;
34
34
}
@@ -53,7 +53,7 @@ pub struct Config {
53
53
impl Config {
54
54
fn new ( storage : Box < dyn StorageOpt > ) -> Config {
55
55
Config {
56
- parseable : Opt :: from_args ( ) ,
56
+ parseable : Opt :: parse ( ) ,
57
57
storage,
58
58
}
59
59
}
@@ -91,7 +91,7 @@ impl Config {
91
91
"Failed to authenticate. Please ensure credentials are valid\n Caused by: {cause}" ,
92
92
cause = inner
93
93
) ,
94
- Err ( error) => { panic ! ( "{error}" ) }
94
+ Err ( error) => { panic ! ( "{error}" ) }
95
95
}
96
96
}
97
97
@@ -164,41 +164,41 @@ impl Config {
164
164
}
165
165
}
166
166
167
- #[ derive( Debug , Clone , StructOpt ) ]
168
- #[ structopt (
167
+ #[ derive( Debug , Clone , Parser ) ]
168
+ #[ command (
169
169
name = "Parseable config" ,
170
170
about = "configuration for Parseable server"
171
171
) ]
172
172
pub struct Opt {
173
173
/// The location of TLS Cert file
174
- #[ structopt ( long, env = "P_TLS_CERT_PATH" ) ]
174
+ #[ arg ( long, env = "P_TLS_CERT_PATH" ) ]
175
175
pub tls_cert_path : Option < PathBuf > ,
176
176
177
177
/// The location of TLS Private Key file
178
- #[ structopt ( long, env = "P_TLS_KEY_PATH" ) ]
178
+ #[ arg ( long, env = "P_TLS_KEY_PATH" ) ]
179
179
pub tls_key_path : Option < PathBuf > ,
180
180
181
181
/// The address on which the http server will listen.
182
- #[ structopt ( long, env = "P_ADDR" , default_value = "0.0.0.0:8000" ) ]
182
+ #[ arg ( long, env = "P_ADDR" , default_value = "0.0.0.0:8000" ) ]
183
183
pub address : String ,
184
184
185
185
/// The local storage path is used as temporary landing point
186
186
/// for incoming events and local cache while querying data pulled
187
187
/// from object storage backend
188
- #[ structopt ( long, env = "P_LOCAL_STORAGE" , default_value = "./data" ) ]
188
+ #[ arg ( long, env = "P_LOCAL_STORAGE" , default_value = "./data" ) ]
189
189
pub local_disk_path : PathBuf ,
190
190
191
191
/// Optional interval after which server would upload uncommited data to
192
192
/// remote object storage platform. Defaults to 1min.
193
- #[ structopt ( long, env = "P_STORAGE_UPLOAD_INTERVAL" , default_value = "60" ) ]
193
+ #[ arg ( long, env = "P_STORAGE_UPLOAD_INTERVAL" , default_value = "60" ) ]
194
194
pub upload_interval : u64 ,
195
195
196
196
/// Optional username to enable basic auth on the server
197
- #[ structopt ( long, env = USERNAME_ENV , default_value = DEFAULT_USERNAME ) ]
197
+ #[ arg ( long, env = USERNAME_ENV , default_value = DEFAULT_USERNAME ) ]
198
198
pub username : String ,
199
199
200
200
/// Optional password to enable basic auth on the server
201
- #[ structopt ( long, env = PASSOWRD_ENV , default_value = DEFAULT_PASSWORD ) ]
201
+ #[ arg ( long, env = PASSOWRD_ENV , default_value = DEFAULT_PASSWORD ) ]
202
202
pub password : String ,
203
203
}
204
204
0 commit comments