     key_or_path = expand_key_or_path(key_or_path, __CALLER__)
 
     quote do
-      Application.__compile_env__(unquote(app), unquote(key_or_path), unquote(default), __ENV__)
+      Application.compile_env(__ENV__, unquote(app), unquote(key_or_path), unquote(default))
     end
   end
 

    key_or_path = expand_key_or_path(key_or_path, __CALLER__)

    quote do
      Application.__compile_env__!(unquote(app), unquote(key_or_path), __ENV__)
    end
  end

  @doc false
  def __compile_env__!(app, key_or_path, env) do
    case fetch_compile_env(app, key_or_path, env) do
      {:ok, value} ->
        value

    end
  end

  defp fetch_compile_env(app, key, env) when is_atom(key) do
    fetch_compile_env(app, key, [], env)
  end

  defp fetch_compile_env(app, [key | paths], env) when is_atom(key),
    do: fetch_compile_env(app, key, paths, env)
