Skip to content

Commit

Permalink
chore: support riak credentials parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ssepml committed Nov 5, 2024
1 parent 3551262 commit 5d6876f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/krc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ conflict_ok_test() ->
{ok, Obj} = get(krc_server,
B,
K,
fun(V1, V2) -> erlang:max(V1, V2) end),
fun(Val1, Val2) -> erlang:max(Val1, Val2) end),
true = erlang:max(V1, V2) =:= krc_obj:val(Obj)
end).

Expand Down
16 changes: 15 additions & 1 deletion src/krc_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,21 @@ opts(set_bucket)-> [].
%% Connections
copts() ->
[ {auto_reconnect, false} %exit on TCP/IP error
].
] ++ sopts().

%% Security options
sopts() ->
RiakUser = application:get_env(?APP, riak_user, undefined),
RiakPass = application:get_env(?APP, riak_pass, ""),
CACert = application:get_env(?APP, riak_cacertfile, undefined),
case RiakUser =/= undefined andalso CACert =/= undefined of
true ->
[ {credentials, RiakUser, RiakPass}
, {cacertfile, CACert}
];
false ->
[]
end.

%% Reads
ropts() ->
Expand Down

0 comments on commit 5d6876f

Please sign in to comment.