   agent gets set again.
   """
   def reset_environment_config! do
-    System.get_env
-    |> Enum.filter(
-      fn({"_APPSIGNAL_" <> _, _}) -> true;
-      (_) -> false end
-    ) |> Enum.each(fn({key, _}) ->
+    System.get_env()
+    |> Enum.filter(fn
+      {"_APPSIGNAL_" <> _, _} -> true
+      _ -> false
+    end)
+    |> Enum.each(fn {key, _} ->
       System.delete_env(key)
     end)
   end

    app_config = Application.get_env(:appsignal, :config, []) |> coerce_map
    env_config = load_from_environment()

    config = @default_config
    |> Map.merge(system_config)
    |> Map.merge(app_config)
    |> Map.merge(env_config)

    config = config
    # Config is valid when we have a push api key
    |> Map.put(:valid, !empty?(config[:push_api_key]))

    Application.put_env(:appsignal, :config, config)

    case config[:valid] do
      true ->
        :ok
      false ->
        {:error, :invalid_config}
    end

  defp app_name_to_string(name) when is_binary(name), do: name

  def get_system_env do
    System.get_env()
    |> Enum.filter(fn
      {"APPSIGNAL_" <> _, _} -> true
      _ -> false
    end)
    |> Enum.into(%{})
  end

  # When you use Appsignal.Config you get a handy config macro which
  # can be used to read the application config.
  defmacro __using__(_) do
    quote do
      defmacro config do
        quote do
          Application.get_env(:appsignal, :config, [])
        end
      end
    end
  end
end
