@@ -9,29 +9,13 @@ use stackable_operator::v2::{
99 config_file_writer:: to_hadoop_xml, config_overrides:: KeyValueConfigOverrides ,
1010} ;
1111
12- use crate :: {
13- container:: { TLS_STORE_DIR , TLS_STORE_PASSWORD } ,
14- controller:: build:: properties:: resolved_overrides,
15- } ;
12+ use crate :: controller:: build:: properties:: { resolved_overrides, truststore_entries} ;
1613
1714/// Renders `ssl-client.xml` for the given HTTPS state and user overrides.
1815pub fn build ( https_enabled : bool , overrides : KeyValueConfigOverrides ) -> String {
1916 let mut config: BTreeMap < String , String > = BTreeMap :: new ( ) ;
2017 if https_enabled {
21- config. extend ( [
22- (
23- "ssl.client.truststore.location" . to_string ( ) ,
24- format ! ( "{TLS_STORE_DIR}/truststore.p12" ) ,
25- ) ,
26- (
27- "ssl.client.truststore.type" . to_string ( ) ,
28- "pkcs12" . to_string ( ) ,
29- ) ,
30- (
31- "ssl.client.truststore.password" . to_string ( ) ,
32- TLS_STORE_PASSWORD . to_string ( ) ,
33- ) ,
34- ] ) ;
18+ config. extend ( truststore_entries ( "ssl.client" ) ) ;
3519 }
3620 // Overrides applied last so users win.
3721 config. extend ( resolved_overrides ( overrides) ) ;
@@ -41,18 +25,14 @@ pub fn build(https_enabled: bool, overrides: KeyValueConfigOverrides) -> String
4125#[ cfg( test) ]
4226mod tests {
4327 use super :: * ;
44- use crate :: controller:: build:: properties:: test_support:: config_overrides;
28+ use crate :: {
29+ container:: { TLS_STORE_DIR , TLS_STORE_PASSWORD } ,
30+ controller:: build:: properties:: test_support:: { EMPTY_HADOOP_XML , config_overrides} ,
31+ } ;
4532
4633 #[ test]
4734 fn disabled_https_without_overrides_renders_empty_configuration ( ) {
48- assert_eq ! (
49- build( false , config_overrides( & [ ] ) ) ,
50- concat!(
51- "<?xml version=\" 1.0\" ?>\n " ,
52- "<configuration>\n " ,
53- "</configuration>"
54- )
55- ) ;
35+ assert_eq ! ( build( false , config_overrides( & [ ] ) ) , EMPTY_HADOOP_XML ) ;
5636 }
5737
5838 #[ test]
0 commit comments