%%% -*- erlang -*-
%%%
%%% This file is part of cloudi_x_hackney released under the Apache 2 license.
%%% See the NOTICE for more information.
%%%

-module(cloudi_x_hackney_app).

-behaviour(application).

%% Application callbacks
-export([start/2,
         stop/1,
         get_app_env/1, get_app_env/2]).

%% ===================================================================
%% Application callbacks
%% ===================================================================

start(_StartType, _StartArgs) ->
  cloudi_x_hackney_sup:start_link().

stop(_State) ->
  ok.

%% @doc return a config value
get_app_env(Key) ->
  get_app_env(Key, undefined).

%% @doc return a config value
get_app_env(Key, Default) ->
  case application:get_env(cloudi_x_hackney, Key) of
    {ok, Val} -> Val;
    undefined -> Default
  end.
