Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit f3f7cfe

Browse files
cleanup
1 parent c419fe8 commit f3f7cfe

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/SqlStreamStore.Server/SqlStreamStoreServerConfiguration.cs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.Generic;
44
using System.Data.Common;
55
using System.Linq;
6-
using System.Reflection;
76
using System.Text;
87
using Microsoft.Extensions.Configuration;
98
using Microsoft.Extensions.Configuration.CommandLine;
@@ -13,15 +12,6 @@ namespace SqlStreamStore.Server
1312
{
1413
internal class SqlStreamStoreServerConfiguration
1514
{
16-
private static readonly 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-
2515
private readonly ConfigurationData _configuration;
2616

2717
public IDictionary Environment { get; }
@@ -70,7 +60,7 @@ private class ConfigurationData
7060

7161
public bool UseCanonicalUris => _configuration.GetValue<bool>(nameof(UseCanonicalUris));
7262
public LogEventLevel LogLevel => _configuration.GetValue(nameof(LogLevel), LogEventLevel.Information);
73-
[Sensitive] public string ConnectionString => _configuration.GetValue<string>(nameof(ConnectionString));
63+
public string ConnectionString => _configuration.GetValue<string>(nameof(ConnectionString));
7464
public string Schema => _configuration.GetValue<string>(nameof(Schema));
7565
public string Provider => _configuration.GetValue<string>(nameof(Provider));
7666
public bool DisableDeletionTracking => _configuration.GetValue<bool>(nameof(DisableDeletionTracking));
@@ -125,7 +115,7 @@ public override string ToString()
125115
.ToString();
126116
}
127117

128-
private static string ProtectConfigurationString(string connectionString)
118+
private static string ProtectConnectionString(string connectionString)
129119
{
130120
var builder = new DbConnectionStringBuilder(false)
131121
{
@@ -155,7 +145,7 @@ private static string ProtectConfigurationString(string connectionString)
155145
=> values.ToDictionary(
156146
x => x.Key,
157147
x => x.Key == nameof(ConnectionString)
158-
? (x.Value.source, ProtectConfigurationString(x.Value.value))
148+
? (x.Value.source, ProtectConnectionString(x.Value.value))
159149
: x.Value);
160150

161151
private IDictionary<string, (string source, string value)> CollectConfiguration()
@@ -191,7 +181,7 @@ public override void Load()
191181
Data = new Dictionary<string, string>
192182
{
193183
[nameof(ConnectionString)] = default,
194-
[nameof(Provider)] = "inmemory",
184+
[nameof(Provider)] = Constants.inmemory,
195185
[nameof(LogLevel)] = nameof(LogEventLevel.Information),
196186
[nameof(Schema)] = default,
197187
[nameof(UseCanonicalUris)] = default,
@@ -286,9 +276,5 @@ where key.StartsWith(_prefix)
286276
.ToDictionary(x => x.key, x => x.value);
287277
}
288278
}
289-
290-
private class SensitiveAttribute : Attribute
291-
{
292-
}
293279
}
294280
}

0 commit comments

Comments
 (0)