Actually make finch take options
This commit is contained in:
parent
82fa766ed7
commit
14b942443f
3 changed files with 37 additions and 4 deletions
|
@ -36,6 +36,33 @@ config :logger, :console,
|
|||
level: :info
|
||||
```
|
||||
|
||||
## Testing with HTTPS
|
||||
|
||||
If you end up developing alongside other software like misskey,
|
||||
you will not be able to federate without an SSL certificate. You should
|
||||
be able to use the snakeoil certificate that comes standard with most
|
||||
distributions or generate one from scratch, then force elixir to accept it.
|
||||
|
||||
HTTP clients are none too keep to accept self-signed certs, but we can do
|
||||
this:
|
||||
|
||||
```elixir
|
||||
config :pleroma, :http,
|
||||
adapter: [
|
||||
pools: %{
|
||||
default: [
|
||||
conn_opts: [
|
||||
transport_opts: [
|
||||
verify: :verify_none
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Now your SSL requests will work. Hooray.
|
||||
|
||||
## Testing
|
||||
|
||||
1. Create a `test.secret.exs` file with the content as shown below
|
||||
|
|
|
@ -58,9 +58,6 @@ def start(_type, _args) do
|
|||
Pleroma.Docs.JSON.compile()
|
||||
limiters_setup()
|
||||
|
||||
Logger.info("Starting Finch")
|
||||
Finch.start_link(name: MyFinch)
|
||||
|
||||
# Define workers and child supervisors to be supervised
|
||||
children =
|
||||
[
|
||||
|
@ -70,6 +67,7 @@ def start(_type, _args) do
|
|||
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
||||
] ++
|
||||
cachex_children() ++
|
||||
http_children() ++
|
||||
[
|
||||
Pleroma.Stats,
|
||||
Pleroma.JobQueueMonitor,
|
||||
|
@ -276,4 +274,13 @@ def limiters_setup do
|
|||
ConcurrentLimiter.new(module, max_running, max_waiting)
|
||||
end)
|
||||
end
|
||||
|
||||
defp http_children do
|
||||
config =
|
||||
[:http, :adapter]
|
||||
|> Config.get([])
|
||||
|> Keyword.put(:name, MyFinch)
|
||||
|
||||
[{Finch, config}]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -65,7 +65,6 @@ def request(method, url, body, headers, options) when is_binary(url) do
|
|||
options = put_in(options[:adapter], adapter_opts)
|
||||
params = options[:params] || []
|
||||
request = build_request(method, headers, options, url, body, params)
|
||||
|
||||
client = Tesla.client([Tesla.Middleware.FollowRedirects])
|
||||
|
||||
request(client, request)
|
||||
|
|
Loading…
Reference in a new issue