diff options
author | Alexander Sedov <asedov@platbox.com> | 2016-10-11 10:33:14 +0300 |
---|---|---|
committer | Alexander Sedov <asedov@platbox.com> | 2016-10-11 10:40:30 +0300 |
commit | 6e9503c4f0232d6e8152b56a7037f22843e53959 (patch) | |
tree | 608c13f27f7c25c4bff6725832bca3f5b720c99b | |
parent | 3966610e532f18f71c6e4d04c3a96d6372ddc390 (diff) |
Rereading system configuration sets up persistent options if possible.
-rw-r--r-- | src/rebar_utils.erl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index aa9e268..dc0bb42 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -414,8 +414,14 @@ user_agent() -> ?FMT("Rebar/~s (OTP/~s)", [Vsn, otp_release()]). reread_config(ConfigList) -> + SetEnv = case version_tuple(?MODULE:otp_release()) of + {X, _, _} when X =< 17 -> + fun application:set_env/3; + _ -> + fun (App, Key, Val) -> application:set_env(App, Key, Val, [{persistent, true}]) end + end, try - [application:set_env(Application, Key, Val) + [SetEnv(Application, Key, Val) || Config <- ConfigList, {Application, Items} <- Config, {Key, Val} <- Items] |