@@ -489,18 +489,7 @@ fn build_rolegroup_config_map(
489
489
// transformed_config.iter(),
490
490
// )
491
491
// .context(PropertiesWriteSnafu)?;
492
- let runtime_properties: String = transformed_config
493
- . iter ( )
494
- . map ( |kv| {
495
- format ! (
496
- "{}={}" ,
497
- kv. 0 ,
498
- kv. 1 . clone( ) . unwrap_or_else( || "" . to_string( ) )
499
- )
500
- } )
501
- . reduce ( |content, line| format ! ( "{content}\n {line}" ) )
502
- . unwrap_or_else ( || "" . to_string ( ) ) ;
503
-
492
+ let runtime_properties = unescape_java_properties ( & transformed_config) ;
504
493
cm_conf_data. insert ( RUNTIME_PROPS . to_string ( ) , runtime_properties) ;
505
494
}
506
495
PropertyNameKind :: File ( file_name) if file_name == JVM_CONFIG => {
@@ -555,6 +544,20 @@ fn build_rolegroup_config_map(
555
544
} )
556
545
}
557
546
547
+ fn unescape_java_properties ( props : & BTreeMap < String , Option < String > > ) -> String {
548
+ props
549
+ . iter ( )
550
+ . map ( |kv| {
551
+ format ! (
552
+ "{}={}" ,
553
+ kv. 0 ,
554
+ kv. 1 . clone( ) . unwrap_or_else( || "" . to_string( ) )
555
+ )
556
+ } )
557
+ . reduce ( |content, line| format ! ( "{content}\n {line}" ) )
558
+ . unwrap_or_else ( || "" . to_string ( ) )
559
+ }
560
+
558
561
/// The rolegroup [`Service`] is a headless service that allows direct access to the instances of a certain rolegroup
559
562
///
560
563
/// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing.
@@ -940,4 +943,18 @@ mod test {
940
943
941
944
Ok ( ( ) )
942
945
}
946
+
947
+
948
+ #[ test]
949
+ fn test_unescape_java_properties ( ) {
950
+ let expected = r#"druid.auth.authenticator.ldap.credentialsValidator.baseDn=ou=users,dc=example,dc=org
951
+ druid.auth.authenticator.ldap.credentialsValidator.bindPassword=admin"# ;
952
+
953
+ let props: BTreeMap < String , Option < String > > = vec ! [
954
+ ( "druid.auth.authenticator.ldap.credentialsValidator.bindPassword" . to_string( ) , Some ( "admin" . to_string( ) ) ) ,
955
+ ( "druid.auth.authenticator.ldap.credentialsValidator.baseDn" . to_string( ) , Some ( "ou=users,dc=example,dc=org" . to_string( ) ) ) ,
956
+ ] . into_iter ( ) . collect ( ) ;
957
+
958
+ assert_eq ! ( expected. to_string( ) , unescape_java_properties( & props) ) ;
959
+ }
943
960
}
0 commit comments