Skip to content

Commit

Permalink
Merge pull request #176 from basho/jd-cuttlefish-api
Browse files Browse the repository at this point in the history
Changes for new cuttlefish api
  • Loading branch information
joedevivo committed Dec 12, 2013
2 parents b020af7 + 5d69da7 commit ab3964b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 11 additions & 5 deletions priv/riak_control.schema
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%%-*- mode: erlang -*-
%% riak_control config
%% @doc Set to 'off' to disable the admin panel.
{mapping, "riak_control", "riak_control.enabled", [
Expand All @@ -8,7 +9,7 @@
{translation,
"riak_control.enabled",
fun(Conf) ->
Setting = cuttlefish_util:conf_get_value("riak_control", Conf),
Setting = cuttlefish:conf_get("riak_control", Conf),
case Setting of
on -> true;
off -> false;
Expand All @@ -26,7 +27,7 @@
{translation,
"riak_control.auth",
fun(Conf) ->
case cuttlefish_util:conf_get_value("riak_control.auth", Conf) of
case cuttlefish:conf_get("riak_control.auth", Conf) of
userlist -> userlist;
off -> none;
_ -> none
Expand All @@ -45,10 +46,15 @@ end}.
"riak_control.userlist",
fun(Conf) ->
UserList = lists:filter(
fun({K, _V}) ->
cuttlefish_util:fuzzy_variable_match(K, string:tokens("riak_control.user.$username.password", "."))
fun({K, _V}) ->
cuttlefish_variable:is_fuzzy_match(K, string:tokens("riak_control.user.$username.password", "."))
end,
Conf),
[ {Username, Password} || {[_, _, Username, _], Password} <- UserList ]
Users = [ {Username, Password} || {[_, _, Username, _], Password} <- UserList ],
case Users of
[] ->
throw(unset);
_ -> Users
end

end}.
3 changes: 2 additions & 1 deletion test/riak_control_schema_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
-compile(export_all).

basic_schema_test() ->
lager:start(),
Config = cuttlefish_unit:generate_config("../priv/riak_control.schema", []),

cuttlefish_unit:assert_config(Config, "riak_control.enabled", false),
cuttlefish_unit:assert_config(Config, "riak_control.auth", userlist),
cuttlefish_unit:assert_config(Config, "riak_control.userlist", [{"user","pass"}]),
cuttlefish_unit:assert_not_configured(Config, "riak_control.userlist"),
ok.

userlist_schema_test() ->
Expand Down

0 comments on commit ab3964b

Please sign in to comment.