Skip to content

Instantly share code, notes, and snippets.

@cstar
Last active December 18, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cstar/e205a17cbc049e96a11d to your computer and use it in GitHub Desktop.
Save cstar/e205a17cbc049e96a11d to your computer and use it in GitHub Desktop.
feature toggle
-mod(feature).
-export([feature/3]).
-spec feature(atom(), fun(), fun()) -> any().
feature(Name, TrueFun, FalseFun)->
case application:get_env(?APPLICATION,toggles, []) of
List ->
case lists:member(Name,List) of
true ->
TrueFun();
false ->
FalseFun()
end
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment