diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-06-05 11:41:51 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-06-05 11:41:51 +0100 |
commit | 6465e45484578dccf83649b6f5745df1bc70f733 (patch) | |
tree | 87f31a5d5850e76b99a5b340bc6ebca6148e6fd8 /src/rabbit.erl | |
parent | cd3164ef9fcba81a1ea6be4db221e5f1ddfbcb82 (diff) | |
download | rabbitmq-server-6465e45484578dccf83649b6f5745df1bc70f733.tar.gz |
Don't show misleading information in the Windows service case when the service has not been reinstalled.bug26227
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r-- | src/rabbit.erl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index c2d7e29d..29e38c1f 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -794,9 +794,25 @@ config_files() -> end, case init:get_argument(config) of {ok, Files} -> [Abs(File) || [File] <- Files]; - error -> case os:getenv("RABBITMQ_CONFIG_FILE") of - false -> []; - File -> [Abs(File) ++ " (not found)"] + error -> case config_setting() of + none -> []; + File -> [Abs(File) ++ " (not found)"] + end + end. + +%% This is a pain. We want to know where the config file is. But we +%% can't specify it on the command line if it is missing or the VM +%% will fail to start, so we need to find it by some mechanism other +%% than init:get_arguments/0. We can look at the environment variable +%% which is responsible for setting it... but that doesn't work for a +%% Windows service since the variable can change and the service not +%% be reinstalled, so in that case we add a magic application env. +config_setting() -> + case application:get_env(rabbit, windows_service_config) of + {ok, File1} -> File1; + undefined -> case os:getenv("RABBITMQ_CONFIG_FILE") of + false -> none; + File2 -> File2 end end. |