fix(search): make the Qdrant clients trust the CAStore bundle
The Qdrant and OpenAI clients do not go through Pleroma.HTTP, so on Hackney they trusted certifi. Both send API keys. Give them the configured adapter with the same TLS options.
This commit is contained in:
parent
8880c502be
commit
d698b96579
3 changed files with 54 additions and 2 deletions
|
|
@ -46,6 +46,24 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
|||
|> adapter_helper().options(uri)
|
||||
end
|
||||
|
||||
@doc """
|
||||
The configured Tesla adapter with TLS options, for clients that do not go
|
||||
through `Pleroma.HTTP`.
|
||||
"""
|
||||
@spec tesla_adapter() :: module() | {module(), keyword()}
|
||||
def tesla_adapter do
|
||||
case adapter() do
|
||||
Tesla.Adapter.Hackney ->
|
||||
{Tesla.Adapter.Hackney, Pleroma.HTTP.TLS.put_hackney_ssl_options([])}
|
||||
|
||||
Tesla.Adapter.Gun ->
|
||||
{Tesla.Adapter.Gun, certificates_verification: true}
|
||||
|
||||
adapter ->
|
||||
adapter
|
||||
end
|
||||
end
|
||||
|
||||
defp adapter, do: Application.get_env(:tesla, :adapter)
|
||||
|
||||
defp adapter_helper do
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ defmodule Pleroma.Search.QdrantSearch.OpenAIClient do
|
|||
end
|
||||
|
||||
defp client do
|
||||
Tesla.client(middleware())
|
||||
Tesla.client(middleware(), Pleroma.HTTP.AdapterHelper.tesla_adapter())
|
||||
end
|
||||
|
||||
defp middleware do
|
||||
|
|
@ -191,7 +191,7 @@ defmodule Pleroma.Search.QdrantSearch.QdrantClient do
|
|||
end
|
||||
|
||||
defp client do
|
||||
Tesla.client(middleware())
|
||||
Tesla.client(middleware(), Pleroma.HTTP.AdapterHelper.tesla_adapter())
|
||||
end
|
||||
|
||||
defp middleware do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue