diff options
author | Siri Hansen <[email protected]> | 2019-03-04 11:54:48 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2019-03-04 11:54:48 +0100 |
commit | aab126fca9a9bf231c2dafcb2450b4b08a72c0c0 (patch) | |
tree | 409500046ef3b6b995558f929b9cc1d9816d5208 /lib/kernel/src/application.erl | |
parent | 3a6424de238a26822a818c5fa5781eea717a5114 (diff) | |
parent | fec6e81808d654d901ca7512dfcccd4894f86548 (diff) | |
download | otp-aab126fca9a9bf231c2dafcb2450b4b08a72c0c0.tar.gz otp-aab126fca9a9bf231c2dafcb2450b4b08a72c0c0.tar.bz2 otp-aab126fca9a9bf231c2dafcb2450b4b08a72c0c0.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/kernel/src/application.erl')
-rw-r--r-- | lib/kernel/src/application.erl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl index bc6be2f8f5..5c2e981e4b 100644 --- a/lib/kernel/src/application.erl +++ b/lib/kernel/src/application.erl @@ -25,7 +25,7 @@ which_applications/0, which_applications/1, loaded_applications/0, permit/2]). -export([ensure_started/1, ensure_started/2]). --export([set_env/3, set_env/4, unset_env/2, unset_env/3]). +-export([set_env/1, set_env/2, set_env/3, set_env/4, unset_env/2, unset_env/3]). -export([get_env/1, get_env/2, get_env/3, get_all_env/0, get_all_env/1]). -export([get_key/1, get_key/2, get_all_key/0, get_all_key/1]). -export([get_application/0, get_application/1, info/0]). @@ -279,6 +279,26 @@ loaded_applications() -> info() -> application_controller:info(). +-spec set_env(Config) -> 'ok' when + Config :: [{Application, Env}], + Application :: atom(), + Env :: [{Par :: atom(), Val :: term()}]. + +set_env(Config) when is_list(Config) -> + set_env(Config, []). + +-spec set_env(Config, Opts) -> 'ok' when + Config :: [{Application, Env}], + Application :: atom(), + Env :: [{Par :: atom(), Val :: term()}], + Opts :: [{timeout, timeout()} | {persistent, boolean()}]. + +set_env(Config, Opts) when is_list(Config), is_list(Opts) -> + case application_controller:set_env(Config, Opts) of + ok -> ok; + {error, Msg} -> erlang:error({badarg, Msg}, [Config, Opts]) + end. + -spec set_env(Application, Par, Val) -> 'ok' when Application :: atom(), Par :: atom(), |