Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Validate Addr parameters
Browse files Browse the repository at this point in the history
.
  • Loading branch information
Gabriele Santomaggio committed Mar 21, 2017
1 parent dac8450 commit 6093cd4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/autocluster_consul.erl
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,25 @@ registration_body_maybe_add_tag(Payload, Cluster) ->
lists:append(Payload, [{'Tags', [list_to_atom(Cluster)]}]).



%%--------------------------------------------------------------------
%% @private
%% @doc
%% Validate CONSUL_SVC_ADDR_NODENAME parameter
%% it can be used if CONSUL_SVC_ADDR_AUTO is true
%% @end
%%--------------------------------------------------------------------

-spec validate_addr_parameters(false | true, false | true) -> false | true.
validate_addr_parameters(false, true) ->
autocluster_log:warning("The params CONSUL_SVC_ADDR_NODENAME" ++
" can be used only if CONSUL_SVC_ADDR_AUTO is true." ++
" CONSUL_SVC_ADDR_NODENAME value will be ignored."),
false;
validate_addr_parameters(_, _) ->
true.


%%--------------------------------------------------------------------
%% @private
%% @doc
Expand All @@ -447,6 +466,8 @@ registration_body_maybe_add_tag(Payload, Cluster) ->
%%--------------------------------------------------------------------
-spec service_address() -> string().
service_address() ->
validate_addr_parameters(autocluster_config:get(consul_svc_addr_auto),
autocluster_config:get(consul_svc_addr_nodename)),
service_address(autocluster_config:get(consul_svc_addr),
autocluster_config:get(consul_svc_addr_auto),
autocluster_config:get(consul_svc_addr_nic),
Expand Down

0 comments on commit 6093cd4

Please sign in to comment.