Use Pleroma.Config everywhere

This commit is contained in:
Egor Kislitsyn 2019-05-30 15:33:58 +07:00
parent 57e58d2602
commit 99f70c7e20
18 changed files with 80 additions and 151 deletions

View File

@ -29,13 +29,13 @@ def system_info do
end end
defp assign_db_info(healthcheck) do defp assign_db_info(healthcheck) do
database = Application.get_env(:pleroma, Repo)[:database] database = Pleroma.Config.get([Repo, :database])
query = query =
"select state, count(pid) from pg_stat_activity where datname = '#{database}' group by state;" "select state, count(pid) from pg_stat_activity where datname = '#{database}' group by state;"
result = Repo.query!(query) result = Repo.query!(query)
pool_size = Application.get_env(:pleroma, Repo)[:pool_size] pool_size = Pleroma.Config.get([Repo, :pool_size])
db_info = db_info =
Enum.reduce(result.rows, %{active: 0, idle: 0}, fn [state, cnt], states -> Enum.reduce(result.rows, %{active: 0, idle: 0}, fn [state, cnt], states ->

View File

@ -22,7 +22,7 @@ defmodule Pleroma.Emoji do
@ets __MODULE__.Ets @ets __MODULE__.Ets
@ets_options [:ordered_set, :protected, :named_table, {:read_concurrency, true}] @ets_options [:ordered_set, :protected, :named_table, {:read_concurrency, true}]
@groups Application.get_env(:pleroma, :emoji)[:groups] @groups Pleroma.Config.get([:emoji, :groups])
@doc false @doc false
def start_link do def start_link do
@ -112,7 +112,7 @@ defp load do
# Compat thing for old custom emoji handling & default emoji, # Compat thing for old custom emoji handling & default emoji,
# it should run even if there are no emoji packs # it should run even if there are no emoji packs
shortcode_globs = Application.get_env(:pleroma, :emoji)[:shortcode_globs] || [] shortcode_globs = Pleroma.Config.get([:emoji, :shortcode_globs], [])
emojis = emojis =
(load_from_file("config/emoji.txt") ++ (load_from_file("config/emoji.txt") ++

View File

@ -104,7 +104,6 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do
paragraphs, breaks and links are allowed through the filter. paragraphs, breaks and links are allowed through the filter.
""" """
@markup Application.get_env(:pleroma, :markup)
@valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], []) @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
require HtmlSanitizeEx.Scrubber.Meta require HtmlSanitizeEx.Scrubber.Meta
@ -142,9 +141,7 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do
Meta.allow_tag_with_these_attributes("span", []) Meta.allow_tag_with_these_attributes("span", [])
# allow inline images for custom emoji # allow inline images for custom emoji
@allow_inline_images Keyword.get(@markup, :allow_inline_images) if Pleroma.Config.get([:markup, :allow_inline_images]) do
if @allow_inline_images do
# restrict img tags to http/https only, because of MediaProxy. # restrict img tags to http/https only, because of MediaProxy.
Meta.allow_tag_with_uri_attributes("img", ["src"], ["http", "https"]) Meta.allow_tag_with_uri_attributes("img", ["src"], ["http", "https"])
@ -168,7 +165,6 @@ defmodule Pleroma.HTML.Scrubber.Default do
# credo:disable-for-previous-line # credo:disable-for-previous-line
# No idea how to fix this one… # No idea how to fix this one…
@markup Application.get_env(:pleroma, :markup)
@valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], []) @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
Meta.remove_cdata_sections_before_scrub() Meta.remove_cdata_sections_before_scrub()
@ -213,7 +209,7 @@ defmodule Pleroma.HTML.Scrubber.Default do
Meta.allow_tag_with_this_attribute_values("span", "class", ["h-card"]) Meta.allow_tag_with_this_attribute_values("span", "class", ["h-card"])
Meta.allow_tag_with_these_attributes("span", []) Meta.allow_tag_with_these_attributes("span", [])
@allow_inline_images Keyword.get(@markup, :allow_inline_images) @allow_inline_images Pleroma.Config.get([:markup, :allow_inline_images])
if @allow_inline_images do if @allow_inline_images do
# restrict img tags to http/https only, because of MediaProxy. # restrict img tags to http/https only, because of MediaProxy.
@ -228,9 +224,7 @@ defmodule Pleroma.HTML.Scrubber.Default do
]) ])
end end
@allow_tables Keyword.get(@markup, :allow_tables) if Pleroma.Config.get([:markup, :allow_tables]) do
if @allow_tables do
Meta.allow_tag_with_these_attributes("table", []) Meta.allow_tag_with_these_attributes("table", [])
Meta.allow_tag_with_these_attributes("tbody", []) Meta.allow_tag_with_these_attributes("tbody", [])
Meta.allow_tag_with_these_attributes("td", []) Meta.allow_tag_with_these_attributes("td", [])
@ -239,9 +233,7 @@ defmodule Pleroma.HTML.Scrubber.Default do
Meta.allow_tag_with_these_attributes("tr", []) Meta.allow_tag_with_these_attributes("tr", [])
end end
@allow_headings Keyword.get(@markup, :allow_headings) if Pleroma.Config.get([:markup, :allow_headings]) do
if @allow_headings do
Meta.allow_tag_with_these_attributes("h1", []) Meta.allow_tag_with_these_attributes("h1", [])
Meta.allow_tag_with_these_attributes("h2", []) Meta.allow_tag_with_these_attributes("h2", [])
Meta.allow_tag_with_these_attributes("h3", []) Meta.allow_tag_with_these_attributes("h3", [])
@ -249,9 +241,7 @@ defmodule Pleroma.HTML.Scrubber.Default do
Meta.allow_tag_with_these_attributes("h5", []) Meta.allow_tag_with_these_attributes("h5", [])
end end
@allow_fonts Keyword.get(@markup, :allow_fonts) if Pleroma.Config.get([:markup, :allow_fonts]) do
if @allow_fonts do
Meta.allow_tag_with_these_attributes("font", ["face"]) Meta.allow_tag_with_these_attributes("font", ["face"])
end end

View File

@ -65,12 +65,9 @@ defp process_sni_options(options, url) do
end end
def process_request_options(options) do def process_request_options(options) do
config = Application.get_env(:pleroma, :http, []) case Pleroma.Config.get([:http, :proxy_url]) do
proxy = Keyword.get(config, :proxy_url, nil)
case proxy do
nil -> options nil -> options
_ -> options ++ [proxy: proxy] proxy -> options ++ [proxy: proxy]
end end
end end

View File

@ -10,7 +10,7 @@ def init(options) do
end end
def call(conn, _opts) do def call(conn, _opts) do
if Keyword.get(Application.get_env(:pleroma, :instance), :federating) do if Pleroma.Config.get([:instance, :federating]) do
conn conn
else else
conn conn

View File

@ -61,7 +61,7 @@ defmodule Pleroma.ReverseProxy do
* `http`: options for [hackney](https://github.com/benoitc/hackney). * `http`: options for [hackney](https://github.com/benoitc/hackney).
""" """
@hackney Application.get_env(:pleroma, :hackney, :hackney) @hackney Pleroma.Config.get(:hackney, :hackney)
@default_hackney_options [] @default_hackney_options []

View File

@ -366,9 +366,7 @@ def follow_all(follower, followeds) do
end end
def follow(%User{} = follower, %User{info: info} = followed) do def follow(%User{} = follower, %User{info: info} = followed) do
user_config = Application.get_env(:pleroma, :user) deny_follow_blocked = Pleroma.Config.get([:user, :deny_follow_blocked])
deny_follow_blocked = Keyword.get(user_config, :deny_follow_blocked)
ap_followers = followed.follower_address ap_followers = followed.follower_address
cond do cond do

View File

@ -399,16 +399,12 @@ def delete(%Object{data: %{"id" => id, "actor" => actor}} = object, local \\ tru
end end
def block(blocker, blocked, activity_id \\ nil, local \\ true) do def block(blocker, blocked, activity_id \\ nil, local \\ true) do
ap_config = Application.get_env(:pleroma, :activitypub) outgoing_blocks = Pleroma.Config.get([:activitypub, :outgoing_blocks])
unfollow_blocked = Keyword.get(ap_config, :unfollow_blocked) unfollow_blocked = Pleroma.Config.get([:activitypub, :unfollow_blocked])
outgoing_blocks = Keyword.get(ap_config, :outgoing_blocks)
with true <- unfollow_blocked do if unfollow_blocked do
follow_activity = fetch_latest_follow(blocker, blocked) follow_activity = fetch_latest_follow(blocker, blocked)
if follow_activity, do: unfollow(blocker, blocked, nil, local)
if follow_activity do
unfollow(blocker, blocked, nil, local)
end
end end
with true <- outgoing_blocks, with true <- outgoing_blocks,

View File

@ -27,7 +27,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
plug(:relay_active? when action in [:relay]) plug(:relay_active? when action in [:relay])
def relay_active?(conn, _) do def relay_active?(conn, _) do
if Keyword.get(Application.get_env(:pleroma, :instance), :allow_relay) do if Pleroma.Config.get([:instance, :allow_relay]) do
conn conn
else else
conn conn

View File

@ -17,9 +17,7 @@ def filter(object) do
end end
def get_policies do def get_policies do
Application.get_env(:pleroma, :instance, []) Pleroma.Config.get([:instance, :rewrite_policy], []) |> get_policies()
|> Keyword.get(:rewrite_policy, [])
|> get_policies()
end end
defp get_policies(policy) when is_atom(policy), do: [policy] defp get_policies(policy) when is_atom(policy), do: [policy]

View File

@ -66,7 +66,7 @@ defmodule Pleroma.Web.Endpoint do
parsers: [:urlencoded, :multipart, :json], parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"], pass: ["*/*"],
json_decoder: Jason, json_decoder: Jason,
length: Application.get_env(:pleroma, :instance) |> Keyword.get(:upload_limit), length: Pleroma.Config.get([:instance, :upload_limit]),
body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []} body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []}
) )

View File

@ -12,25 +12,27 @@ def url(""), do: nil
def url("/" <> _ = url), do: url def url("/" <> _ = url), do: url
def url(url) do def url(url) do
config = Application.get_env(:pleroma, :media_proxy, []) if !enabled?() or local?(url) or whitelisted?(url) do
domain = URI.parse(url).host
cond do
!Keyword.get(config, :enabled, false) or String.starts_with?(url, Pleroma.Web.base_url()) ->
url url
else
Enum.any?(Pleroma.Config.get([:media_proxy, :whitelist]), fn pattern ->
String.equivalent?(domain, pattern)
end) ->
url
true ->
encode_url(url) encode_url(url)
end end
end end
defp enabled?, do: Pleroma.Config.get([:media_proxy, :enabled], false)
defp local?(url), do: String.starts_with?(url, Pleroma.Web.base_url())
defp whitelisted?(url) do
%{host: domain} = URI.parse(url)
Enum.any?(Pleroma.Config.get([:media_proxy, :whitelist]), fn pattern ->
String.equivalent?(domain, pattern)
end)
end
def encode_url(url) do def encode_url(url) do
secret = Application.get_env(:pleroma, Pleroma.Web.Endpoint)[:secret_key_base] secret = Pleroma.Config.get([Pleroma.Web.Endpoint, :secret_key_base])
# Must preserve `%2F` for compatibility with S3 # Must preserve `%2F` for compatibility with S3
# https://git.pleroma.social/pleroma/pleroma/issues/580 # https://git.pleroma.social/pleroma/pleroma/issues/580
@ -52,7 +54,7 @@ def encode_url(url) do
end end
def decode_url(sig, url) do def decode_url(sig, url) do
secret = Application.get_env(:pleroma, Pleroma.Web.Endpoint)[:secret_key_base] secret = Pleroma.Config.get([Pleroma.Web.Endpoint, :secret_key_base])
sig = Base.url_decode64!(sig, @base64_opts) sig = Base.url_decode64!(sig, @base64_opts)
local_sig = :crypto.hmac(:sha, secret, url) local_sig = :crypto.hmac(:sha, secret, url)

View File

@ -32,20 +32,15 @@ def schemas(conn, _params) do
# returns a nodeinfo 2.0 map, since 2.1 just adds a repository field # returns a nodeinfo 2.0 map, since 2.1 just adds a repository field
# under software. # under software.
def raw_nodeinfo do def raw_nodeinfo do
instance = Application.get_env(:pleroma, :instance)
media_proxy = Application.get_env(:pleroma, :media_proxy)
suggestions = Application.get_env(:pleroma, :suggestions)
chat = Application.get_env(:pleroma, :chat)
gopher = Application.get_env(:pleroma, :gopher)
stats = Stats.get_stats() stats = Stats.get_stats()
mrf_simple = mrf_simple =
Application.get_env(:pleroma, :mrf_simple) Config.get(:mrf_simple)
|> Enum.into(%{}) |> Enum.into(%{})
# This horror is needed to convert regex sigils to strings # This horror is needed to convert regex sigils to strings
mrf_keyword = mrf_keyword =
Application.get_env(:pleroma, :mrf_keyword, []) Config.get(:mrf_keyword, [])
|> Enum.map(fn {key, value} -> |> Enum.map(fn {key, value} ->
{key, {key,
Enum.map(value, fn Enum.map(value, fn
@ -74,14 +69,7 @@ def raw_nodeinfo do
MRF.get_policies() MRF.get_policies()
|> Enum.map(fn policy -> to_string(policy) |> String.split(".") |> List.last() end) |> Enum.map(fn policy -> to_string(policy) |> String.split(".") |> List.last() end)
quarantined = Keyword.get(instance, :quarantined_instances) quarantined = Config.get([:instance, :quarantined_instances], [])
quarantined =
if is_list(quarantined) do
quarantined
else
[]
end
staff_accounts = staff_accounts =
User.all_superusers() User.all_superusers()
@ -92,7 +80,7 @@ def raw_nodeinfo do
|> Enum.into(%{}, fn {k, v} -> {k, length(v)} end) |> Enum.into(%{}, fn {k, v} -> {k, length(v)} end)
federation_response = federation_response =
if Keyword.get(instance, :mrf_transparency) do if Config.get([:instance, :mrf_transparency]) do
%{ %{
mrf_policies: mrf_policies, mrf_policies: mrf_policies,
mrf_simple: mrf_simple, mrf_simple: mrf_simple,
@ -109,22 +97,22 @@ def raw_nodeinfo do
"pleroma_api", "pleroma_api",
"mastodon_api", "mastodon_api",
"mastodon_api_streaming", "mastodon_api_streaming",
if Keyword.get(media_proxy, :enabled) do if Config.get([:media_proxy, :enabled]) do
"media_proxy" "media_proxy"
end, end,
if Keyword.get(gopher, :enabled) do if Config.get([:gopher, :enabled]) do
"gopher" "gopher"
end, end,
if Keyword.get(chat, :enabled) do if Config.get([:chat, :enabled]) do
"chat" "chat"
end, end,
if Keyword.get(suggestions, :enabled) do if Config.get([:suggestions, :enabled]) do
"suggestions" "suggestions"
end, end,
if Keyword.get(instance, :allow_relay) do if Config.get([:instance, :allow_relay]) do
"relay" "relay"
end, end,
if Keyword.get(instance, :safe_dm_mentions) do if Config.get([:instance, :safe_dm_mentions]) do
"safe_dm_mentions" "safe_dm_mentions"
end end
] ]
@ -141,7 +129,7 @@ def raw_nodeinfo do
inbound: [], inbound: [],
outbound: [] outbound: []
}, },
openRegistrations: Keyword.get(instance, :registrations_open), openRegistrations: Config.get([:instance, :registrations_open]),
usage: %{ usage: %{
users: %{ users: %{
total: stats.user_count || 0 total: stats.user_count || 0
@ -149,29 +137,29 @@ def raw_nodeinfo do
localPosts: stats.status_count || 0 localPosts: stats.status_count || 0
}, },
metadata: %{ metadata: %{
nodeName: Keyword.get(instance, :name), nodeName: Config.get([:instance, :name]),
nodeDescription: Keyword.get(instance, :description), nodeDescription: Config.get([:instance, :description]),
private: !Keyword.get(instance, :public, true), private: !Config.get([:instance, :public], true),
suggestions: %{ suggestions: %{
enabled: Keyword.get(suggestions, :enabled, false), enabled: Config.get([:suggestions, :enabled], false),
thirdPartyEngine: Keyword.get(suggestions, :third_party_engine, ""), thirdPartyEngine: Config.get([:suggestions, :third_party_engine], ""),
timeout: Keyword.get(suggestions, :timeout, 5000), timeout: Config.get([:suggestions, :timeout], 5000),
limit: Keyword.get(suggestions, :limit, 23), limit: Config.get([:suggestions, :limit], 23),
web: Keyword.get(suggestions, :web, "") web: Config.get([:suggestions, :web], "")
}, },
staffAccounts: staff_accounts, staffAccounts: staff_accounts,
federation: federation_response, federation: federation_response,
postFormats: Keyword.get(instance, :allowed_post_formats), postFormats: Config.get([:instance, :allowed_post_formats]),
uploadLimits: %{ uploadLimits: %{
general: Keyword.get(instance, :upload_limit), general: Config.get([:instance, :upload_limit]),
avatar: Keyword.get(instance, :avatar_upload_limit), avatar: Config.get([:instance, :avatar_upload_limit]),
banner: Keyword.get(instance, :banner_upload_limit), banner: Config.get([:instance, :banner_upload_limit]),
background: Keyword.get(instance, :background_upload_limit) background: Config.get([:instance, :background_upload_limit])
}, },
accountActivationRequired: Keyword.get(instance, :account_activation_required, false), accountActivationRequired: Config.get([:instance, :account_activation_required], false),
invitesEnabled: Keyword.get(instance, :invites_enabled, false), invitesEnabled: Config.get([:instance, :invites_enabled], false),
features: features, features: features,
restrictedNicknames: Pleroma.Config.get([Pleroma.User, :restricted_nicknames]) restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames])
} }
} }
end end

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui" /> <meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui" />
<title> <title>
<%= Application.get_env(:pleroma, :instance)[:name] %> <%= Pleroma.Config.get([:instance, :name]) %>
</title> </title>
<style> <style>
body { body {
@ -194,7 +194,7 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1><%= Application.get_env(:pleroma, :instance)[:name] %></h1> <h1><%= Pleroma.Config.get([:instance, :name]) %></h1>
<%= render @view_module, @view_template, assigns %> <%= render @view_module, @view_template, assigns %>
</div> </div>
</body> </body>

View File

@ -4,7 +4,7 @@
<meta charset='utf-8'> <meta charset='utf-8'>
<meta content='width=device-width, initial-scale=1' name='viewport'> <meta content='width=device-width, initial-scale=1' name='viewport'>
<title> <title>
<%= Application.get_env(:pleroma, :instance)[:name] %> <%= Pleroma.Config.get([:instance, :name]) %>
</title> </title>
<link rel="icon" type="image/png" href="/favicon.png"/> <link rel="icon" type="image/png" href="/favicon.png"/>
<script crossorigin='anonymous' src="/packs/locales.js"></script> <script crossorigin='anonymous' src="/packs/locales.js"></script>

View File

@ -728,7 +728,7 @@ defp forbidden_json_reply(conn, error_message) do
def only_if_public_instance(%{assigns: %{user: %User{}}} = conn, _), do: conn def only_if_public_instance(%{assigns: %{user: %User{}}} = conn, _), do: conn
def only_if_public_instance(conn, _) do def only_if_public_instance(conn, _) do
if Keyword.get(Application.get_env(:pleroma, :instance), :public) do if Pleroma.Config.get([:instance, :public]) do
conn conn
else else
conn conn

View File

@ -6,11 +6,7 @@ defmodule Pleroma.Web.FederatingPlugTest do
use Pleroma.Web.ConnCase use Pleroma.Web.ConnCase
test "returns and halt the conn when federating is disabled" do test "returns and halt the conn when federating is disabled" do
instance = Pleroma.Config.put([:instance, :federating], false)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:federating, false)
Application.put_env(:pleroma, :instance, instance)
conn = conn =
build_conn() build_conn()
@ -19,11 +15,7 @@ test "returns and halt the conn when federating is disabled" do
assert conn.status == 404 assert conn.status == 404
assert conn.halted assert conn.halted
instance = Pleroma.Config.put([:instance, :federating], true)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:federating, true)
Application.put_env(:pleroma, :instance, instance)
end end
test "does nothing when federating is enabled" do test "does nothing when federating is enabled" do

View File

@ -144,41 +144,25 @@ test "returns statuses", %{conn: conn} do
end end
test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do
instance = Pleroma.Config.put([:instance, :public], false)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, false)
Application.put_env(:pleroma, :instance, instance)
conn conn
|> get("/api/statuses/public_timeline.json") |> get("/api/statuses/public_timeline.json")
|> json_response(403) |> json_response(403)
instance = Pleroma.Config.put([:instance, :public], true)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, true)
Application.put_env(:pleroma, :instance, instance)
end end
test "returns 200 to authenticated request when the instance is not public", test "returns 200 to authenticated request when the instance is not public",
%{conn: conn, user: user} do %{conn: conn, user: user} do
instance = Pleroma.Config.put([:instance, :public], false)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, false)
Application.put_env(:pleroma, :instance, instance)
conn conn
|> with_credentials(user.nickname, "test") |> with_credentials(user.nickname, "test")
|> get("/api/statuses/public_timeline.json") |> get("/api/statuses/public_timeline.json")
|> json_response(200) |> json_response(200)
instance = Pleroma.Config.put([:instance, :public], true)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, true)
Application.put_env(:pleroma, :instance, instance)
end end
test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do
@ -214,41 +198,25 @@ test "returns 200 to authenticated request when the instance is public",
setup [:valid_user] setup [:valid_user]
test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do test "returns 403 to unauthenticated request when the instance is not public", %{conn: conn} do
instance = Pleroma.Config.put([:instance, :public], false)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, false)
Application.put_env(:pleroma, :instance, instance)
conn conn
|> get("/api/statuses/public_and_external_timeline.json") |> get("/api/statuses/public_and_external_timeline.json")
|> json_response(403) |> json_response(403)
instance = Pleroma.Config.put([:instance, :public], true)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, true)
Application.put_env(:pleroma, :instance, instance)
end end
test "returns 200 to authenticated request when the instance is not public", test "returns 200 to authenticated request when the instance is not public",
%{conn: conn, user: user} do %{conn: conn, user: user} do
instance = Pleroma.Config.put([:instance, :public], false)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, false)
Application.put_env(:pleroma, :instance, instance)
conn conn
|> with_credentials(user.nickname, "test") |> with_credentials(user.nickname, "test")
|> get("/api/statuses/public_and_external_timeline.json") |> get("/api/statuses/public_and_external_timeline.json")
|> json_response(200) |> json_response(200)
instance = Pleroma.Config.put([:instance, :public], true)
Application.get_env(:pleroma, :instance)
|> Keyword.put(:public, true)
Application.put_env(:pleroma, :instance, instance)
end end
test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do test "returns 200 to unauthenticated request when the instance is public", %{conn: conn} do