Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Management should not use IPAddress.Any as its default hostname #156

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/management/Akka.Management/AkkaManagementSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ namespace Akka.Management
public class AkkaManagementSettings
{
public AkkaManagementSettings(Config config) =>
Http = new Http(config.GetConfig("akka.management"));
Http = new Http(config);

public Http Http { get; }
}

public class Http
{
public Http(Config managementConfig)
public Http(Config config)
{
var managementConfig = config.GetConfig("akka.management");
var cc = managementConfig.GetConfig("http");

var hostname = cc.GetString("hostname");
Hostname = hostname == "<hostname>" || string.IsNullOrWhiteSpace(hostname) ? IPAddress.Any.ToString() : hostname;
if (string.IsNullOrWhiteSpace(hostname) || hostname.Equals("<hostname>"))
hostname = config.GetString("akka.remote.dot-netty.tcp.public-hostname");
if (string.IsNullOrWhiteSpace(hostname))
hostname = Dns.GetHostName();
Hostname = hostname;

Port = cc.GetInt("port");
if (Port < 0 || Port > 65535)
Expand Down
5 changes: 3 additions & 2 deletions src/management/Akka.Management/Resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ akka.management {
http {
# The hostname where the HTTP Server for Http Cluster Management will be started.
# This defines the interface to use.
# InetAddress.getLocalHost.getHostAddress is used not overriden or empty
# akka.remote.dot-netty.tcp.public-hostname is used if not overriden or empty.
# if akka.remote.dot-netty.tcp.public-hostname is empty, Dns.GetHostName is used.
Aaronontheweb marked this conversation as resolved.
Show resolved Hide resolved
hostname = "<hostname>"

# The port where the HTTP Server for Http Cluster Management will be bound.
# The value will need to be from 0 to 65535.
port = 8558 # port pun, it "complements" 2552 which is often used for Akka remoting
port = 8558

# Use this setting to bind a network interface to a different hostname or ip
# than the HTTP Server for Http Cluster Management.
Expand Down