summaryrefslogtreecommitdiff
path: root/src/rabbit.erl
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2020-01-16 14:22:07 +0100
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2020-02-03 10:12:49 +0100
commit15b07b66ceba56509da843f73c8c9a151bd6d08c (patch)
tree1d330e03f3ee5ae1b8183a59f1c2bceb10debb48 /src/rabbit.erl
parent3be5483ec22feca1460e09aaf21b629c9c72ec3e (diff)
downloadrabbitmq-server-git-15b07b66ceba56509da843f73c8c9a151bd6d08c.tar.gz
Move all RabbitMQ-specific environment variables to `rabbit_env`
The reading of `$NOTIFY_SOCKET` is also moved at the same time. This is in preparation of the work around start/stop status. There is an associated commit in rabbitmq-common to update `rabbit_env` and record the origin of each variable. [#170149339]
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r--src/rabbit.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 0bf6d47700..41a54ba36c 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -386,10 +386,9 @@ maybe_sd_notify() ->
end.
sd_notify_ready() ->
- case {os:type(), os:getenv("NOTIFY_SOCKET")} of
- {{win32, _}, _} ->
- true;
- {_, [_|_]} -> %% Non-empty NOTIFY_SOCKET, give it a try
+ case rabbit_prelaunch:get_context() of
+ #{systemd_notify_socket := Socket} when Socket =/= undefined ->
+ %% Non-empty NOTIFY_SOCKET, give it a try
sd_notify_legacy() orelse sd_notify_socat();
_ ->
true
@@ -432,9 +431,11 @@ socat_socket_arg(UnixSocket) ->
"unix-sendto:" ++ UnixSocket.
sd_open_port() ->
+ #{systemd_notify_socket := Socket} = rabbit_prelaunch:get_context(),
+ true = Socket =/= undefined,
open_port(
{spawn_executable, os:find_executable("socat")},
- [{args, [socat_socket_arg(os:getenv("NOTIFY_SOCKET")), "STDIO"]},
+ [{args, [socat_socket_arg(Socket), "STDIO"]},
use_stdio, out]).
sd_notify_socat(Unit) ->