%% -*- mode: erlang; -*-
case erlang:function_exported(rebar3, main, 1) of
    true -> % rebar3
        CONFIG;
    false -> % rebar 2.x or older
        %% Use git-based deps
        %% profiles
        CONFIG_DEPS =
        [{deps, [{meck, ".*",{git, "https://github.com/eproxus/meck.git", {tag, "0.9.0"}}},
                 {jsx, ".*", {git, "https://github.com/talentdeficit/jsx.git", {tag, "v2.11.0"}}},
                 %% {hackney, ".*", {git, "git://github.com/benoitc/hackney.git", {tag, "1.2.0"}}},
                 {eini, ".*", {git, "https://github.com/erlcloud/eini.git", {tag, "1.2.9"}}},
                 {lhttpc, ".*", {git, "https://github.com/erlcloud/lhttpc.git", {tag, "1.6.2"}}},
                 {base16, ".*", {git, "https://github.com/goj/base16.git", {tag, "1.0.0"}}}]}
         | lists:keydelete(deps, 1, CONFIG)],
        CONFIG_NEW =
            case os:getenv("WARNINGS_AS_ERRORS") of
                "true" ->
                    [{erl_opts, [warnings_as_errors | proplists:get_value(erl_opts, CONFIG_DEPS)]}
                     | lists:keydelete(erl_opts, 1, CONFIG_DEPS)];
                _ ->
                    CONFIG_DEPS
            end,
        CONFIG_NEW
end.
