@@ -52,7 +52,7 @@ pub const DEFAULT_PASSWORD: &str = "admin";
52
52
long_about = r#"
53
53
Cloud Native, log analytics platform for modern applications.
54
54
55
- Usage:
55
+ Usage:
56
56
parseable [command] [options..]
57
57
58
58
@@ -126,7 +126,7 @@ pub struct Options {
126
126
// Server configuration
127
127
#[ arg(
128
128
long,
129
- env = "P_ADDR" ,
129
+ env = "P_ADDR" ,
130
130
default_value = "0.0.0.0:8000" ,
131
131
value_parser = validation:: socket_addr,
132
132
help = "Address and port for Parseable HTTP(s) server"
@@ -294,35 +294,8 @@ pub struct Options {
294
294
) ]
295
295
pub ingestor_endpoint : String ,
296
296
297
- // OIDC Configuration
298
- #[ arg(
299
- long,
300
- long = "oidc-client" ,
301
- env = "P_OIDC_CLIENT_ID" ,
302
- requires = "oidc" ,
303
- group = "oidc" ,
304
- help = "Client id for OIDC provider"
305
- ) ]
306
- oidc_client_id : Option < String > ,
307
-
308
- #[ arg(
309
- long,
310
- env = "P_OIDC_CLIENT_SECRET" ,
311
- requires = "oidc" ,
312
- group = "oidc" ,
313
- help = "Client secret for OIDC provider"
314
- ) ]
315
- oidc_client_secret : Option < String > ,
316
-
317
- #[ arg(
318
- long,
319
- env = "P_OIDC_ISSUER" ,
320
- value_parser = validation:: url,
321
- requires = "oidc" ,
322
- group = "oidc" ,
323
- help = "OIDC provider's host address"
324
- ) ]
325
- oidc_issuer : Option < Url > ,
297
+ #[ command( flatten) ]
298
+ oidc : Option < OidcConfig > ,
326
299
327
300
// Kafka configuration (conditionally compiled)
328
301
#[ cfg( any(
@@ -391,6 +364,34 @@ pub struct Options {
391
364
pub ms_clarity_tag : Option < String > ,
392
365
}
393
366
367
+ #[ derive( Parser , Debug ) ]
368
+ pub struct OidcConfig {
369
+ #[ arg(
370
+ long = "oidc-client-id" ,
371
+ env = "P_OIDC_CLIENT_ID" ,
372
+ required = false ,
373
+ help = "Client id for OIDC provider"
374
+ ) ]
375
+ pub client_id : String ,
376
+
377
+ #[ arg(
378
+ long = "oidc-client-secret" ,
379
+ env = "P_OIDC_CLIENT_SECRET" ,
380
+ required = false ,
381
+ help = "Client secret for OIDC provider"
382
+ ) ]
383
+ pub secret : String ,
384
+
385
+ #[ arg(
386
+ long = "oidc-issuer" ,
387
+ env = "P_OIDC_ISSUER" ,
388
+ required = false ,
389
+ value_parser = validation:: url,
390
+ help = "OIDC provider's host address"
391
+ ) ]
392
+ pub issuer : Url ,
393
+ }
394
+
394
395
impl Options {
395
396
pub fn local_stream_data_path ( & self , stream_name : & str ) -> PathBuf {
396
397
self . local_staging_path . join ( stream_name)
@@ -405,28 +406,24 @@ impl Options {
405
406
}
406
407
407
408
pub fn openid ( & self ) -> Option < OpenidConfig > {
408
- match (
409
- & self . oidc_client_id ,
410
- & self . oidc_client_secret ,
411
- & self . oidc_issuer ,
412
- ) {
413
- ( Some ( id) , Some ( secret) , Some ( issuer) ) => {
414
- let origin = if let Some ( url) = self . domain_address . clone ( ) {
415
- oidc:: Origin :: Production ( url)
416
- } else {
417
- oidc:: Origin :: Local {
418
- socket_addr : self . address . clone ( ) ,
419
- https : self . tls_cert_path . is_some ( ) && self . tls_key_path . is_some ( ) ,
420
- }
421
- } ;
422
- Some ( OpenidConfig {
423
- id : id. clone ( ) ,
424
- secret : secret. clone ( ) ,
425
- issuer : issuer. clone ( ) ,
426
- origin,
427
- } )
409
+ let OidcConfig {
410
+ secret,
411
+ client_id,
412
+ issuer,
413
+ } = self . oidc . as_ref ( ) ?;
414
+ let origin = if let Some ( url) = self . domain_address . clone ( ) {
415
+ oidc:: Origin :: Production ( url)
416
+ } else {
417
+ oidc:: Origin :: Local {
418
+ socket_addr : self . address . clone ( ) ,
419
+ https : self . tls_cert_path . is_some ( ) && self . tls_key_path . is_some ( ) ,
428
420
}
429
- _ => None ,
430
- }
421
+ } ;
422
+ Some ( OpenidConfig {
423
+ id : client_id. clone ( ) ,
424
+ secret : secret. clone ( ) ,
425
+ issuer : issuer. clone ( ) ,
426
+ origin,
427
+ } )
431
428
}
432
429
}
0 commit comments