IsRebar3 = erlang:function_exported(rebar3, main, 1),
IsNoSnappy = case os:getenv("KAFKA_PROTOCOL_NO_SNAPPY") of
               "1" -> true;
               _   -> false
             end,
case {IsNoSnappy, IsRebar3} of
  {true, _} ->
    lists:keyreplace(deps, 1, CONFIG, {deps, []});
  {false, true} ->
    CONFIG;
  {false, false} ->
    [{snappyer, Tag}] = proplists:get_value(deps, CONFIG),
    Url = "https://github.com/zmstone/snappyer",
    Rebar2Deps = [{snappyer, ".*", {git, Url, {tag, Tag}}}],
    lists:keyreplace(deps, 1, CONFIG, {deps, Rebar2Deps})
end.

