Skip to content

Commit

Permalink
rabbit_prelaunch_conf: Style fixes
Browse files Browse the repository at this point in the history
Things like staying in the 80-column limit and spaces around '='.

(cherry picked from commit 03f1e7a)
  • Loading branch information
dumbbell committed Jun 26, 2020
1 parent 3ba6f59 commit 870f893
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions apps/rabbitmq_prelaunch/src/rabbit_prelaunch_conf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ find_actual_main_config_file(#{main_config_file := File}) ->
case filelib:is_regular(NewFormatFile) of
true ->
rabbit_log_prelaunch:warning(
"Both old (.config) and new (.conf) format config "
"files exist."),
"Both old (.config) and new (.conf) format "
"config files exist."),
rabbit_log_prelaunch:warning(
"Using the old format config file: ~s",
[OldFormatFile]),
rabbit_log_prelaunch:warning(
"Please update your config files to the new format "
"and remove the old file."),
"Please update your config files to the new "
"format and remove the old file."),
ok;
false ->
ok
Expand Down Expand Up @@ -211,9 +211,12 @@ generate_config_from_cuttlefish_files(Context,
rabbit_log_prelaunch:error("Error parsing configuration:"),
lists:foreach(
fun(Error) ->
rabbit_log_prelaunch:error(" - ~ts", [cuttlefish_error:xlate(Error)])
rabbit_log_prelaunch:error(
" - ~ts",
[cuttlefish_error:xlate(Error)])
end, Errors),
rabbit_log_prelaunch:error("Are these files using the Cuttlefish format?"),
rabbit_log_prelaunch:error(
"Are these files using the Cuttlefish format?"),
throw({error, failed_to_parse_configuration_file});
Config0 ->
%% Finalize configuration, based on the schema.
Expand Down Expand Up @@ -361,17 +364,16 @@ apply_erlang_term_based_config([]) ->
ok.

apply_app_env_vars(App, [{Var, Value} | Rest]) ->
rabbit_log_prelaunch:debug(
" - ~s = ~p",
[Var, Value]),
rabbit_log_prelaunch:debug(" - ~s = ~p", [Var, Value]),
ok = application:set_env(App, Var, Value, [{persistent, true}]),
apply_app_env_vars(App, Rest);
apply_app_env_vars(_, []) ->
ok.

set_credentials_obfuscation_secret() ->
rabbit_log_prelaunch:debug("Refreshing credentials obfuscation configuration from env: ~p",
[application:get_all_env(credentials_obfuscation)]),
rabbit_log_prelaunch:debug(
"Refreshing credentials obfuscation configuration from env: ~p",
[application:get_all_env(credentials_obfuscation)]),
ok = credentials_obfuscation:refresh_config(),
CookieBin = rabbit_data_coercion:to_binary(erlang:get_cookie()),
rabbit_log_prelaunch:debug(
Expand Down Expand Up @@ -415,9 +417,11 @@ decrypt_app(App, [{Key, Value} | Tail], Algo) ->
end,
decrypt_app(App, Tail, Algo2).

decrypt({encrypted, _}=EncValue, {Cipher, Hash, Iterations, PassPhrase} = Algo) ->
{rabbit_pbe:decrypt_term(Cipher, Hash, Iterations, PassPhrase, EncValue), Algo};
decrypt({encrypted, _}=EncValue,
decrypt({encrypted, _} = EncValue,
{Cipher, Hash, Iterations, PassPhrase} = Algo) ->
{rabbit_pbe:decrypt_term(Cipher, Hash, Iterations, PassPhrase, EncValue),
Algo};
decrypt({encrypted, _} = EncValue,
ConfigEntryDecoder)
when is_list(ConfigEntryDecoder) ->
Algo = config_entry_decoder_to_algo(ConfigEntryDecoder),
Expand Down Expand Up @@ -451,7 +455,8 @@ config_entry_decoder_to_algo(ConfigEntryDecoder) ->
proplists:get_value(
hash, ConfigEntryDecoder, rabbit_pbe:default_hash()),
proplists:get_value(
iterations, ConfigEntryDecoder, rabbit_pbe:default_iterations()),
iterations, ConfigEntryDecoder,
rabbit_pbe:default_iterations()),
PassPhrase
}
end.
Expand Down

0 comments on commit 870f893

Please sign in to comment.