diff options
author | Fredrik Gustafsson <fredrik@erlang.org> | 2013-01-17 12:30:20 +0100 |
---|---|---|
committer | Fredrik Gustafsson <fredrik@erlang.org> | 2013-01-17 12:30:20 +0100 |
commit | 60cabff61c07f5d5cb9dde1eb6b8e73897a0f928 (patch) | |
tree | 098c829a13ea565e5152221527defa0b9bce6a36 /lib/kernel/src | |
parent | cc7e26049cae8cb95793cf9af98424907a2ce644 (diff) | |
parent | 37654ca0993d24753d6596f7a5e4e784030092c4 (diff) | |
download | otp-60cabff61c07f5d5cb9dde1eb6b8e73897a0f928.tar.gz otp-60cabff61c07f5d5cb9dde1eb6b8e73897a0f928.tar.bz2 otp-60cabff61c07f5d5cb9dde1eb6b8e73897a0f928.zip |
Merge branch 'sal/get_env/OTP-10694'
* sal/get_env/OTP-10694:
Moved documentation in a separate entry
Removed obsolete ?line macro
Add application:get_key/3
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/application.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/kernel/src/application.erl b/lib/kernel/src/application.erl index 9b7c4aa7b8..4e65883be7 100644 --- a/lib/kernel/src/application.erl +++ b/lib/kernel/src/application.erl @@ -23,7 +23,7 @@ which_applications/0, which_applications/1, loaded_applications/0, permit/2]). -export([set_env/3, set_env/4, unset_env/2, unset_env/3]). --export([get_env/1, get_env/2, get_all_env/0, get_all_env/1]). +-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]). -export([start_type/0]). @@ -264,6 +264,20 @@ get_env(Key) -> get_env(Application, Key) -> application_controller:get_env(Application, Key). +-spec get_env(Application, Par, Def) -> Val when + Application :: atom(), + Par :: atom(), + Def :: term(), + Val :: term(). + +get_env(Application, Key, Def) -> + case get_env(Application, Key) of + {ok, Val} -> + Val; + undefined -> + Def + end. + -spec get_all_env() -> Env when Env :: [{Par :: atom(), Val :: term()}]. |