Merge branch 'filter-tesla-config' into 'develop'
Filter tesla config See merge request pleroma/pleroma!2722
This commit is contained in:
commit
a2cabb99ca
|
@ -12,6 +12,11 @@ defmodule Pleroma.Config.Loader do
|
||||||
:swarm
|
:swarm
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@reject_groups [
|
||||||
|
:postgrex,
|
||||||
|
:tesla
|
||||||
|
]
|
||||||
|
|
||||||
if Code.ensure_loaded?(Config.Reader) do
|
if Code.ensure_loaded?(Config.Reader) do
|
||||||
@reader Config.Reader
|
@reader Config.Reader
|
||||||
|
|
||||||
|
@ -47,7 +52,8 @@ defp filter(configs) do
|
||||||
@spec filter_group(atom(), keyword()) :: keyword()
|
@spec filter_group(atom(), keyword()) :: keyword()
|
||||||
def filter_group(group, configs) do
|
def filter_group(group, configs) do
|
||||||
Enum.reject(configs[group], fn {key, _v} ->
|
Enum.reject(configs[group], fn {key, _v} ->
|
||||||
key in @reject_keys or (group == :phoenix and key == :serve_endpoints) or group == :postgrex
|
key in @reject_keys or group in @reject_groups or
|
||||||
|
(group == :phoenix and key == :serve_endpoints)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.RemoveTeslaFromConfig do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
execute("DELETE FROM config WHERE config.group = ':tesla'")
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,6 @@ defmodule Pleroma.Config.HolderTest do
|
||||||
test "default_config/0" do
|
test "default_config/0" do
|
||||||
config = Holder.default_config()
|
config = Holder.default_config()
|
||||||
assert config[:pleroma][Pleroma.Uploaders.Local][:uploads] == "test/uploads"
|
assert config[:pleroma][Pleroma.Uploaders.Local][:uploads] == "test/uploads"
|
||||||
assert config[:tesla][:adapter] == Tesla.Mock
|
|
||||||
|
|
||||||
refute config[:pleroma][Pleroma.Repo]
|
refute config[:pleroma][Pleroma.Repo]
|
||||||
refute config[:pleroma][Pleroma.Web.Endpoint]
|
refute config[:pleroma][Pleroma.Web.Endpoint]
|
||||||
|
@ -18,17 +17,15 @@ test "default_config/0" do
|
||||||
refute config[:pleroma][:configurable_from_database]
|
refute config[:pleroma][:configurable_from_database]
|
||||||
refute config[:pleroma][:database]
|
refute config[:pleroma][:database]
|
||||||
refute config[:phoenix][:serve_endpoints]
|
refute config[:phoenix][:serve_endpoints]
|
||||||
|
refute config[:tesla][:adapter]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "default_config/1" do
|
test "default_config/1" do
|
||||||
pleroma_config = Holder.default_config(:pleroma)
|
pleroma_config = Holder.default_config(:pleroma)
|
||||||
assert pleroma_config[Pleroma.Uploaders.Local][:uploads] == "test/uploads"
|
assert pleroma_config[Pleroma.Uploaders.Local][:uploads] == "test/uploads"
|
||||||
tesla_config = Holder.default_config(:tesla)
|
|
||||||
assert tesla_config[:adapter] == Tesla.Mock
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "default_config/2" do
|
test "default_config/2" do
|
||||||
assert Holder.default_config(:pleroma, Pleroma.Uploaders.Local) == [uploads: "test/uploads"]
|
assert Holder.default_config(:pleroma, Pleroma.Uploaders.Local) == [uploads: "test/uploads"]
|
||||||
assert Holder.default_config(:tesla, :adapter) == Tesla.Mock
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue