Skip to content

Commit

Permalink
Do lazy evaluation where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira committed Jul 6, 2021
1 parent 4a1a9bf commit c5ea558
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/elvis_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ from_file(Path, Key, Default) ->

-spec from_application_or_config(atom(), term()) -> term().
from_application_or_config(Key, Default) ->
application:get_env(elvis_core, Key, from_file("elvis.config", Key, Default)).
case application:get_env(elvis_core, Key) of
{ok, Value} ->
Value;
_ ->
from_file("elvis.config", Key, Default)
end.

-spec load(atom(), term(), term()) -> configs().
load(Key, ElvisConfig, Default) ->
Expand Down

0 comments on commit c5ea558

Please sign in to comment.