anchor.diff:    end.
   
   keyget(Key, Data) ->
  -    keyget(Key, Data, undefined).
  +  keyget(Key, Data, undefined).
   
   keyget(Key, Data, Default) ->
  -    case lists:keyfind(Key, 1, Data) of
  -        false ->
  -            Default;
  -        {Key, Value} ->
  -            Value
  -    end.
  +  case lists:keyfind(Key, 1, Data) of
  +    false ->
  +      Default;
  +    {Key, Value} ->
  +      Value
  +  end.
   
   % Private functions
   
  
positive.code:         ]).
  
  -export([
      storage_env/0,
      storage_type/0,
      storage_user/0,
      storage_pass/0,
      storage_host/0,
      storage_port/0,
      storage_dir/0
  ]).
  
  -export([
           keyget/2,
  
negative.code:   keyget(max_processes, zone_server_env(), 16).
  
  zone_server_protocol() ->
    keyget(protocol, zone_server_env(), "https").
  
  zone_server_host() ->
    keyget(host, zone_server_env(), "localhost").
  
  zone_server_port() ->
    keyget(port, zone_server_env(), ?DEFAULT_ZONE_SERVER_PORT).
  
  websocket_env() ->
    keyget(websocket, zone_server_env(), []).
  
  websocket_protocol() ->
    keyget(protocol, websocket_env(), wss).
  
  websocket_host() ->
    keyget(host, websocket_env(), zone_server_host()).
  
  websocket_port() ->
    keyget(port, websocket_env(), zone_server_port()).
  
  websocket_path() ->
    keyget(path, websocket_env(), ?DEFAULT_WEBSOCKET_PATH).
  
  websocket_url() ->
    atom_to_list(websocket_protocol()) ++ "://" ++ websocket_host() ++ ":" ++ integer_to_list(websocket_port()) ++ websocket_path().
  
  storage_type() ->
    storage_get(type).
  
  storage_dir() ->
    storage_get(dir).
  
  storage_user() ->
    storage_get(user).
  
  storage_pass() ->
    storage_get(pass).
  
  storage_host() ->
    storage_get(host).
  
  storage_port() ->
    storage_get(port).
  
  storage_env() ->
    get_env(storage).
  
  get_env(storage) ->
    case application:get_env(erldns, storage) of
      undefined ->
        [{type, erldns_storage_json},
         {dir, undefined},
         {user, undefined},
         {pass, undefined},
         {host, undefined},
         {port, undefined}];
      {ok, Env} ->
        Env
    end.
  
  storage_get(Key) ->
    case lists:keyfind(Key, 1, get_env(storage)) of
      false ->
        undefined;
      {Key, Value} ->
        Value
    end.
  