We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34711b4 commit 0f569d7Copy full SHA for 0f569d7
deps/rabbitmq_stream/src/rabbit_stream.erl
@@ -31,12 +31,21 @@ start(_Type, _Args) ->
31
host() ->
32
case application:get_env(rabbitmq_stream, advertised_host, undefined) of
33
undefined ->
34
- {ok, Host} = inet:gethostname(),
35
- list_to_binary(Host);
+ hostname_from_node();
36
Host ->
37
rabbit_data_coercion:to_binary(Host)
38
end.
39
+hostname_from_node() ->
40
+ case re:split(rabbit_data_coercion:to_binary(node()),
41
+ "@",
42
+ [{return, binary}, {parts, 2}]) of
43
+ [_, Hostname] ->
44
+ Hostname;
45
+ [_] ->
46
+ rabbit_data_coercion:to_binary(inet:gethostname())
47
+ end.
48
+
49
port() ->
50
case application:get_env(rabbitmq_stream, advertised_port, undefined) of
51
0 commit comments