Skip to content

Commit a932760

Browse files
Dharmishtha PatelDharmishtha Patel
authored andcommitted
Add default hostname value for embedded RavenDB
1 parent 2528b27 commit a932760

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/ServiceControl.Audit.Persistence.RavenDB/RavenPersistenceConfiguration.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace ServiceControl.Audit.Persistence.RavenDB
22
{
33
using System;
4+
using System.Configuration;
45
using System.Collections.Generic;
56
using System.IO;
67
using System.Reflection;
@@ -100,20 +101,13 @@ internal static DatabaseConfiguration GetDatabaseConfiguration(PersistenceSettin
100101
throw new InvalidOperationException($"{DatabaseMaintenancePortKey} must be an integer.");
101102
}
102103

103-
// Determine host for embedded RavenDB from persister-specific settings
104-
string host = "localhost";
105104

106-
if (settings.PersisterSpecificSettings.TryGetValue("ServiceControl.Audit/HostName", out var configuredHost) ||
107-
settings.PersisterSpecificSettings.TryGetValue("ServiceControl/HostName", out configuredHost))
105+
string host = "localhost";
106+
if (!string.IsNullOrEmpty(settings.Hostname))
108107
{
109-
configuredHost = configuredHost?.Trim();
110-
if (!string.IsNullOrWhiteSpace(configuredHost))
111-
{
112-
// Map '*' to '+' for Raven wildcard (bind all interfaces). Accept '+' as-is.
113-
host = configuredHost == "*" ? "+" : configuredHost;
114-
}
108+
// Map '*' to '+' for Raven wildcard (bind all interfaces). Accept '+' as-is.
109+
host = settings.Hostname == "*" ? "+" : settings.Hostname;
115110
}
116-
117111
var serverUrl = $"http://{host}:{databaseMaintenancePort}";
118112

119113
var logPath = GetLogPath(settings);

0 commit comments

Comments
 (0)