@@ -13,9 +13,17 @@ namespace SqlStreamStore.Server
1313{
1414 internal class SqlStreamStoreServerConfiguration
1515 {
16+ private readonly static string [ ] s_sensitiveKeys = typeof ( ConfigurationData ) . GetProperties ( )
17+ . Where ( property => property . GetCustomAttributes < SensitiveAttribute > ( ) . Any ( ) )
18+ . Select ( property => property . Name )
19+ . ToArray ( ) ;
20+
21+ private static readonly string [ ] s_allKeys = typeof ( ConfigurationData ) . GetProperties ( )
22+ . Select ( property => property . Name )
23+ . ToArray ( ) ;
24+
1625 private readonly ConfigurationData _configuration ;
1726 private readonly IDictionary < string , ( string source , string value ) > _values ;
18- private readonly string [ ] _sensitiveKeys ;
1927
2028 public bool UseCanonicalUris => _configuration . UseCanonicalUris ;
2129 public LogEventLevel LogLevel => _configuration . LogLevel ;
@@ -33,10 +41,6 @@ public SqlStreamStoreServerConfiguration(
3341 throw new ArgumentNullException ( nameof ( args ) ) ;
3442
3543 _values = new Dictionary < string , ( string source , string value ) > ( ) ;
36- _sensitiveKeys = typeof ( ConfigurationData ) . GetProperties ( )
37- . Where ( property => property . GetCustomAttributes < SensitiveAttribute > ( ) . Any ( ) )
38- . Select ( property => property . Name )
39- . ToArray ( ) ;
4044
4145 void Log ( string logName , IDictionary < string , string > data )
4246 {
@@ -76,17 +80,20 @@ public override string ToString()
7680 "─┼─" ,
7781 new string ( '─' , column0Width ) ,
7882 new string ( '─' , column1Width ) ,
79- new string ( '─' , column2Width ) ,
83+ new string ( '─' , column2Width )
8084 }
8185 }
82- . Concat ( _values . Keys . OrderBy ( key => key )
83- . Select ( key => new [ ] { delimiter , key , _values [ key ] . value , _values [ key ] . source } ) )
86+ . Concat (
87+ _values . Keys
88+ . Where ( s_allKeys . Contains )
89+ . OrderBy ( key => key )
90+ . Select ( key => new [ ] { delimiter , key , _values [ key ] . value , _values [ key ] . source } ) )
8491 . Aggregate (
8592 new StringBuilder ( ) . AppendLine ( "SQL Stream Store Configuration:" ) ,
8693 ( builder , values ) => builder
8794 . Append ( ( values [ 1 ] ?? string . Empty ) . PadRight ( column0Width , ' ' ) )
8895 . Append ( values [ 0 ] )
89- . Append ( ( _sensitiveKeys . Contains ( values [ 1 ] )
96+ . Append ( ( s_sensitiveKeys . Contains ( values [ 1 ] )
9097 ? new string ( '*' , Math . Min ( column1Width , 8 ) )
9198 : values [ 2 ] ?? string . Empty ) . PadRight ( column1Width , ' ' ) )
9299 . Append ( values [ 0 ] )
0 commit comments