From e6220d1ab18fe05b82afdb49babe11c18486d088 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 3 Nov 2014 11:28:45 -0800 Subject: [PATCH] Avoid using application:get_env/3, since R15 doesn't have it --- src/epna_sup.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/epna_sup.erl b/src/epna_sup.erl index 6ce1803..61b13cf 100644 --- a/src/epna_sup.erl +++ b/src/epna_sup.erl @@ -36,8 +36,8 @@ start_pool(Name, Size, Timeout, ConnectFun, CloseFun) -> init([]) -> RestartStrategy = simple_one_for_one, - MaxR = application:get_env(episcina, max_restarts, 1000), - MaxT = application:get_env(episcina, max_seconds_between_restarts, 3600), + MaxR = get_env(max_restarts, 1000), + MaxT = get_env(max_seconds_between_restarts, 3600), SupFlags = {RestartStrategy, MaxR, MaxT}, @@ -53,3 +53,11 @@ init([]) -> %%%=================================================================== %%% Internal functions %%%=================================================================== + +get_env(Key, Default) -> + case application:get_env(episcina, Key) of + undefined -> + Default; + {ok, Value} -> + Value + end.