~cypheon/ecertmon

35cd6d3405541e2516c10cc7970d130a3e68e251 — Johann Rudloff 1 year, 9 months ago 08c2ae1
Use application:set_env/3 instead of /2 for compatibility with OTP < 21
1 files changed, 6 insertions(+), 3 deletions(-)

M src/certmon_app.erl
M src/certmon_app.erl => src/certmon_app.erl +6 -3
@@ 25,9 25,12 @@ stop(_State) ->

load_config_file(FilePath) ->
  case file:consult(FilePath) of
    {ok, Config} -> application:set_env([{certmon, Config}]),
                    logger:notice("Config loaded from ~n", [FilePath]),
                    ok;
    {ok, Config} -> 
      lists:map(
        fun ({Par, Val}) -> application:set_env(certmon, Par, Val) end, Config
       ),
          logger:notice("Config loaded from ~n", [FilePath]),
          ok;
    {error, Error} -> logger:error("Unable to load config file from path ~p: ~p, please set the environment variable CERTMON_CONFIG_FILE accordingly", [FilePath, Error]),
         Error
  end.