Get rid of Pleroma.Config in favor of Application
Discussed in https://git.pleroma.social/pleroma/pleroma/merge_requests/426#note_7232
This commit is contained in:
parent
0f6c4635a6
commit
2bc924ba45
7 changed files with 25 additions and 38 deletions
|
|
@ -10,7 +10,6 @@ defmodule Pleroma.Application do
|
|||
# Define workers and child supervisors to be supervised
|
||||
children =
|
||||
[
|
||||
worker(Pleroma.Config, [Application.get_all_env(:pleroma)]),
|
||||
# Start the Ecto repository
|
||||
supervisor(Pleroma.Repo, []),
|
||||
worker(Pleroma.Emoji, []),
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
defmodule Pleroma.Config do
|
||||
use Agent
|
||||
|
||||
def start_link(initial) do
|
||||
Agent.start_link(fn -> initial end, name: __MODULE__)
|
||||
end
|
||||
|
||||
def get(path) do
|
||||
Agent.get(__MODULE__, Kernel, :get_in, [path])
|
||||
end
|
||||
|
||||
def put(path, value) do
|
||||
Agent.update(__MODULE__, Kernel, :put_in, [path, value])
|
||||
end
|
||||
end
|
||||
|
|
@ -6,7 +6,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
|||
alias Pleroma.Web.ActivityPub.Relay
|
||||
alias Pleroma.Web.ActivityPub.Utils
|
||||
alias Pleroma.Web.Federator
|
||||
alias Pleroma.Config
|
||||
|
||||
require Logger
|
||||
|
||||
|
|
@ -15,7 +14,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
|||
plug(:relay_active? when action in [:relay])
|
||||
|
||||
def relay_active?(conn, _) do
|
||||
if Config.get([:instance, :allow_relay]) do
|
||||
if Keyword.get(Application.get_env(:pleroma, :instance), :allow_relay) do
|
||||
conn
|
||||
else
|
||||
conn
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ defmodule Pleroma.Web.Federator do
|
|||
alias Pleroma.Web.ActivityPub.Relay
|
||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||
alias Pleroma.Web.ActivityPub.Utils
|
||||
alias Pleroma.Config
|
||||
require Logger
|
||||
|
||||
@websub Application.get_env(:pleroma, :websub)
|
||||
|
|
@ -72,7 +71,7 @@ defmodule Pleroma.Web.Federator do
|
|||
Logger.info(fn -> "Sending #{activity.data["id"]} out via Salmon" end)
|
||||
Pleroma.Web.Salmon.publish(actor, activity)
|
||||
|
||||
if Config.get([:instance, :allow_relay]) do
|
||||
if Keyword.get(Application.get_env(:pleroma, :instance), :allow_relay) do
|
||||
Logger.info(fn -> "Relaying #{activity.data["id"]} out" end)
|
||||
Relay.publish(activity)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue