diff options
| author | Michael Klishin <michael@novemberain.com> | 2016-03-24 00:29:04 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@novemberain.com> | 2016-03-24 00:29:04 +0300 |
| commit | 117a20bc2383d6ee841547468fb615f34e4916f5 (patch) | |
| tree | 3c3c3f43ec6506980334d0180cff8fa6a70e79e8 /src/rabbit.erl | |
| parent | a5a24d32733e80e0ab1b5383d17bb405bd58d743 (diff) | |
| parent | 2b9b292de4e2f31f49fc9b9e99396aa47c1c8d53 (diff) | |
| download | rabbitmq-server-git-117a20bc2383d6ee841547468fb615f34e4916f5.tar.gz | |
Merge pull request #575 from rabbitmq/rabbitmq-server-550
Support new configuration format
Diffstat (limited to 'src/rabbit.erl')
| -rw-r--r-- | src/rabbit.erl | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 3dbee29543..7816cd53aa 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -272,6 +272,7 @@ start() -> boot() -> start_it(fun() -> + ensure_config(), ok = ensure_application_loaded(), HipeResult = rabbit_hipe:maybe_hipe_compile(), ok = start_logger(), @@ -285,6 +286,20 @@ boot() -> broker_start() end). +ensure_config() -> + case rabbit_config:prepare_and_use_config() of + {error, Reason} -> + {Format, Arg} = case Reason of + {generation_error, Error} -> {"~s", [Error]}; + Other -> {"~p", [Other]} + end, + log_boot_error_and_exit(generate_config_file, + "~nConfig file generation failed "++Format, + Arg); + ok -> ok + end. + + broker_start() -> Plugins = rabbit_plugins:setup(), ToBeLoaded = Plugins ++ ?APPS, @@ -902,32 +917,7 @@ home_dir() -> end. config_files() -> - Abs = fun (F) -> - filename:absname(filename:rootname(F, ".config") ++ ".config") - end, - case init:get_argument(config) of - {ok, Files} -> [Abs(File) || [File] <- Files]; - 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. + rabbit_config:config_files(). %% We don't want this in fhc since it references rabbit stuff. And we can't put %% this in the bootstep directly. |
