Skip to content

Commit

Permalink
better config handling in patch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
drewkerrigan committed Jun 23, 2016
1 parent 6e1dbe6 commit e640780
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/riak_explorer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,19 @@ stop(_State) ->

-spec should_clean_default_cluster() -> boolean().
should_clean_default_cluster() ->
{ok, EtcDir} = application:get_env(riak_explorer, platform_etc_dir),
EtcFile = filename:join([EtcDir, "riak_explorer.conf"]),
Proc = fun(Entry, Accum) ->
case re:run(Entry, "^clusters.default.*$", []) of
{match, _} -> false;
_ -> Accum
end
end,
re_file_util:for_each_line_in_file(EtcFile, Proc, read, true).
case application:get_env(riak_explorer, platform_etc_dir) of
{ok, EtcDir} ->
EtcFile = filename:join([EtcDir, "riak_explorer.conf"]),
Proc = fun(Entry, Accum) ->
case re:run(Entry, "^clusters.default.*$", []) of
{match, _} -> false;
_ -> Accum
end
end,
re_file_util:for_each_line_in_file(EtcFile, Proc, read, true);
_ ->
false
end.

-spec props_to_bin([{atom(), term()}], [{atom(), atom() | binary()}]) -> [{atom(), atom() | binary()}].
props_to_bin([], Accum) -> lists:reverse(Accum);
Expand Down

0 comments on commit e640780

Please sign in to comment.