aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/application.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2014-02-14 15:51:20 +0100
committerHenrik Nord <[email protected]>2014-02-14 15:52:49 +0100
commit6c9fa95961fcd8737fc14d75e904641c1e605440 (patch)
treefd6e994a66b1adcb59095a0c19953af47b5bebdd /lib/kernel/src/application.erl
parent9c1c834d9cf5b050a6ad781f8a74cbf56e9033b2 (diff)
parent8c049f556e2656598fcf1059efc20a64927f2d66 (diff)
downloadotp-6c9fa95961fcd8737fc14d75e904641c1e605440.tar.gz
otp-6c9fa95961fcd8737fc14d75e904641c1e605440.tar.bz2
otp-6c9fa95961fcd8737fc14d75e904641c1e605440.zip
Merge branch 'josevalim/jv-persistent-set-env'
* josevalim/jv-persistent-set-env: Allow persistent option on set_env/4 and unset_env/3 OTP-11708
Diffstat (limited to 'lib/kernel/src/application.erl')
-rw-r--r--lib/kernel/src/application.erl20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl
index c3bf1ac012..76a80553b0 100644
--- a/lib/kernel/src/application.erl
+++ b/lib/kernel/src/application.erl
@@ -285,16 +285,18 @@ info() ->
set_env(Application, Key, Val) ->
application_controller:set_env(Application, Key, Val).
--spec set_env(Application, Par, Val, Timeout) -> 'ok' when
+-spec set_env(Application, Par, Val, Opts) -> 'ok' when
Application :: atom(),
Par :: atom(),
Val :: term(),
- Timeout :: timeout().
+ Opts :: [{timeout, timeout()} | {persistent, boolean()}].
set_env(Application, Key, Val, infinity) ->
- application_controller:set_env(Application, Key, Val, infinity);
+ set_env(Application, Key, Val, [{timeout, infinity}]);
set_env(Application, Key, Val, Timeout) when is_integer(Timeout), Timeout>=0 ->
- application_controller:set_env(Application, Key, Val, Timeout).
+ set_env(Application, Key, Val, [{timeout, Timeout}]);
+set_env(Application, Key, Val, Opts) when is_list(Opts) ->
+ application_controller:set_env(Application, Key, Val, Opts).
-spec unset_env(Application, Par) -> 'ok' when
Application :: atom(),
@@ -303,15 +305,17 @@ set_env(Application, Key, Val, Timeout) when is_integer(Timeout), Timeout>=0 ->
unset_env(Application, Key) ->
application_controller:unset_env(Application, Key).
--spec unset_env(Application, Par, Timeout) -> 'ok' when
+-spec unset_env(Application, Par, Opts) -> 'ok' when
Application :: atom(),
Par :: atom(),
- Timeout :: timeout().
+ Opts :: [{timeout, timeout()} | {persistent, boolean()}].
unset_env(Application, Key, infinity) ->
- application_controller:unset_env(Application, Key, infinity);
+ unset_env(Application, Key, [{timeout, infinity}]);
unset_env(Application, Key, Timeout) when is_integer(Timeout), Timeout>=0 ->
- application_controller:unset_env(Application, Key, Timeout).
+ unset_env(Application, Key, [{timeout, Timeout}]);
+unset_env(Application, Key, Opts) when is_list(Opts) ->
+ application_controller:unset_env(Application, Key, Opts).
-spec get_env(Par) -> 'undefined' | {'ok', Val} when
Par :: atom(),