Req backend is now upstreamed

This commit is contained in:
Liam 2025-03-12 12:15:01 -04:00
parent 8a864bd176
commit eb525cc341
2 changed files with 1 additions and 32 deletions

View file

@ -88,7 +88,7 @@ config :philomena, :s3_secondary_options,
config :philomena, :s3_secondary_bucket, System.get_env("ALT_S3_BUCKET")
config :ex_aws, http_client: PhilomenaMedia.Req
config :ex_aws, http_client: ExAws.Request.Req
config :ex_aws, :retries,
max_attempts: 20,

View file

@ -1,31 +0,0 @@
defmodule PhilomenaMedia.Req do
@behaviour ExAws.Request.HttpClient
@moduledoc """
Configuration for `m:Req`.
Options can be set for `m:Req` with the following config:
config :philomena, :req_opts,
receive_timeout: 30_000
The default config handles setting the above.
"""
@default_opts [receive_timeout: 30_000]
@impl true
def request(method, url, body \\ "", headers \\ [], http_opts \\ []) do
[method: method, url: url, body: body, headers: headers, decode_body: false]
|> Keyword.merge(Application.get_env(:philomena, :req_opts, @default_opts))
|> Keyword.merge(http_opts)
|> Req.request()
|> case do
{:ok, %{status: status, headers: headers, body: body}} ->
{:ok, %{status_code: status, headers: headers, body: body}}
{:error, reason} ->
{:error, %{reason: reason}}
end
end
end