Skip to content

Commit

Permalink
Add missing rebar3_depup plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Nov 13, 2024
1 parent 8f736ab commit 51d99f3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
20 changes: 2 additions & 18 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@
]}.

{project_plugins, [
erlfmt
]}.

{deps, [
{lager, "3.9.2"},
folsom,
cowboy,
dns_erlang,
erldns
]}.

{erlfmt, [
write,
{print_width, 140}
]}.

{shell, [
{apps, [erldns_admin]}
erlfmt,
rebar3_depup
]}.
4 changes: 3 additions & 1 deletion src/erldns_admin.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
{description, "Erlang Authoritative DNS Server Admin API"},
{vsn, "1.1.0"},
{mod, {erldns_admin_app, []}},
{applications, [kernel, stdlib, inets, crypto, ssl, observer, bear, folsom, ranch, cowboy, erldns]}
{applications, [
kernel, stdlib, inets, crypto, ssl, observer, bear, folsom, ranch, cowboy, erldns
]}
]}.
3 changes: 2 additions & 1 deletion src/erldns_admin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ init([]) ->
{"/", erldns_admin_root_handler, []},
{"/zones/:zone_name", erldns_admin_zone_resource_handler, []},
{"/zones/:zone_name/records/", erldns_admin_zone_records_resource_handler, []},
{"/zones/:zone_name/records/:record_name", erldns_admin_zone_records_resource_handler, []},
{"/zones/:zone_name/records/:record_name",
erldns_admin_zone_records_resource_handler, []},
{"/zones/:zone_name/:action", erldns_admin_zone_control_handler, []}
]}
]
Expand Down
10 changes: 8 additions & 2 deletions src/erldns_admin_zone_records_resource_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ to_json(Req, State) ->

case lists:keyfind(<<"type">>, 1, Params) of
false ->
lager:debug("Received GET (zone_name: ~p, record_name: ~p, record_type: unspecified)", [ZoneName, RecordName]),
lager:debug(
"Received GET (zone_name: ~p, record_name: ~p, record_type: unspecified)", [
ZoneName, RecordName
]
),
{erldns_zone_encoder:zone_records_to_json(ZoneName, RecordName), Req, State};
{<<"type">>, RecordType} ->
lager:debug("Received GET (zone_name: ~p, record_name: ~p, record_type: ~p)", [ZoneName, RecordName, RecordType]),
lager:debug("Received GET (zone_name: ~p, record_name: ~p, record_type: ~p)", [
ZoneName, RecordName, RecordType
]),
{erldns_zone_encoder:zone_records_to_json(ZoneName, RecordName, RecordType), Req, State}
end.
20 changes: 17 additions & 3 deletions src/erldns_admin_zone_resource_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
-module(erldns_admin_zone_resource_handler).

-export([init/2]).
-export([content_types_provided/2, is_authorized/2, resource_exists/2, allowed_methods/2, delete_resource/2]).
-export([
content_types_provided/2,
is_authorized/2,
resource_exists/2,
allowed_methods/2,
delete_resource/2
]).
-export([to_html/2, to_json/2, to_text/2]).

-behaviour(cowboy_rest).
Expand Down Expand Up @@ -72,14 +78,22 @@ to_json(Req, State) ->
{erldns_zone_encoder:zone_to_json(Zone), Req, State};
{error, Reason} ->
lager:error("Error getting zone: ~p", [Reason]),
{halt, cowboy_req:reply(400, [], io_lib:format("Error getting zone: ~p", [Reason]), Req), State}
{halt,
cowboy_req:reply(
400, [], io_lib:format("Error getting zone: ~p", [Reason]), Req
),
State}
end;
_ ->
case erldns_zone_cache:get_zone(Name) of
{ok, Zone} ->
{erldns_zone_encoder:zone_meta_to_json(Zone), Req, State};
{error, Reason} ->
lager:error("Error getting zone: ~p", [Reason]),
{halt, cowbow_req:reply(400, [], io_lib:format("Error getting zone: ~p", [Reason]), Req), State}
{halt,
cowbow_req:reply(
400, [], io_lib:format("Error getting zone: ~p", [Reason]), Req
),
State}
end
end.

0 comments on commit 51d99f3

Please sign in to comment.