Current section

Files

Jump to
diint_utilites_common_app src utilites application_settings.erl
Raw

src/utilites/application_settings.erl

%%%-------------------------------------------------------------------
%%% @author dn290597jan
%%% @copyright (C) 2016, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 27. Apr 2016 13:48
%%%-------------------------------------------------------------------
-module(application_info).
-author("dn290597jan").
%% API
-export([get_section_settings/2]).
get_section_settings(Application,Key) ->
case os:getenv("ERLANG_ENV") of
'Prod' ->
case get_section_with_suffix(Application,Key,"_prod") of
undefined -> application_info:get_section_settings(Application, Key);
Ather -> Ather
end; % env var not defined
'Stage' -> case get_section_with_suffix(Application,Key,"_stage") of
undefined -> application_info:get_section_settings(Application, Key);
Ather -> Ather
end; % env var not defined
_ -> application_info:get_section_settings(Application, Key)
end.
get_section_with_suffix(Application,Key,Suffix)->
NewKey = list_to_atom(string:join([Key,Suffix])),
application_info:get_section_settings(Application, NewKey).