Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update riak_core_web to use riak_core_config to get environment

variable information and update riak_core_sup in response to those
changes to riak_core_web.
  • Loading branch information...
commit 177e6e97a3bab5171273e0e31a671eccb07a75e4 1 parent 1da42e5
@kellymclaughlin kellymclaughlin authored
Showing with 19 additions and 35 deletions.
  1. +2 −10 src/riak_core_sup.erl
  2. +17 −25 src/riak_core_web.erl
View
12 src/riak_core_sup.erl
@@ -46,16 +46,8 @@ start_link() ->
%% ===================================================================
init([]) ->
- RiakWebs = case lists:flatten(riak_core_web:bindings(http),
- riak_core_web:bindings(https)) of
- [] ->
- %% check for old settings, in case app.config
- %% was not updated
- riak_core_web:old_binding();
- Binding ->
- Binding
- end,
-
+ RiakWebs = lists:flatten(riak_core_web:bindings(http),
+ riak_core_web:bindings(https)),
Children = lists:flatten(
[?CHILD(riak_core_sysmon_minder, worker),
?CHILD(riak_core_vnode_sup, supervisor),
View
42 src/riak_core_web.erl
@@ -33,34 +33,26 @@
%%</dd></dl>
-module(riak_core_web).
--export([bindings/1,
- old_binding/0]).
+-export([bindings/1]).
-bindings(Scheme) ->
- Pairs = app_helper:get_env(riak_core, Scheme, []),
- [binding_config(Scheme, Pair) || Pair <- Pairs].
-
-%% read the old, unwrapped web_ip and web_port config
-old_binding() ->
- case {app_helper:get_env(riak_core, web_ip),
- app_helper:get_env(riak_core, web_port)} of
- {IP, Port} when IP /= undefined,
- Port /= undefined ->
- error_logger:warning_msg(
- "app.config is using old-style {web_ip, ~p} and"
- " {web_port, ~p} settings in its riak_core configuration.~n"
- "These are now deprecated, and will be removed in a"
- " future version of Riak.~n"
- "Please migrate to the new-style riak_core configuration"
- " of {http, [{~p, ~p}]}.~n",
- [IP, Port, IP, Port]),
- [binding_config(http, {IP, Port})];
- _ ->
- %% do not start the HTTP interface if any part of its
- %% config is missing (maintains 0.13 behavior)
- []
+bindings(http) ->
+ case riak_core_config:http() of
+ error ->
+ [];
+ ConfigPairs ->
+ binding_configs(http, ConfigPairs)
+ end;
+bindings(https) ->
+ case riak_core_config:https() of
+ error ->
+ [];
+ ConfigPairs ->
+ binding_configs(https, ConfigPairs)
end.
+binding_configs(Scheme, ConfigPairs) ->
+ [binding_config(Scheme, Pair) || Pair <- ConfigPairs].
+
binding_config(Scheme, Binding) ->
{Ip, Port} = Binding,
Name = spec_name(Scheme, Ip, Port),
Please sign in to comment.
Something went wrong with that request. Please try again.