aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/controllers
diff options
context:
space:
mode:
authorhref <href@random.sh>2018-11-06 19:34:57 +0100
committerhref <href@random.sh>2018-11-06 19:41:15 +0100
commit5bb88fd1749931e755157760ec833c5d50ebb8c8 (patch)
treea43e1d2cb7812bd8df741203126e1ca12052c058 /lib/pleroma/web/twitter_api/controllers
parent25512aa29cae22b73ee45a22954693c1a130ea3e (diff)
downloadpleroma-5bb88fd1749931e755157760ec833c5d50ebb8c8.tar.gz
Runtime configuration
Related to #85 Everything should now be configured at runtime, with the exception of the `Pleroma.HTML` scrubbers (the scrubbers used can be changed at runtime, but their configuration is compile-time) because it's building a module with a macro.
Diffstat (limited to 'lib/pleroma/web/twitter_api/controllers')
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex55
1 files changed, 28 insertions, 27 deletions
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
index e84438e97..dc4a864d6 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -134,19 +134,20 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
end
end
- @instance Application.get_env(:pleroma, :instance)
- @instance_fe Application.get_env(:pleroma, :fe)
- @instance_chat Application.get_env(:pleroma, :chat)
def config(conn, _params) do
+ instance = Pleroma.Config.get(:instance)
+ instance_fe = Pleroma.Config.get(:fe)
+ instance_chat = Pleroma.Config.get(:chat)
+
case get_format(conn) do
"xml" ->
response = """
<config>
<site>
- <name>#{Keyword.get(@instance, :name)}</name>
+ <name>#{Keyword.get(instance, :name)}</name>
<site>#{Web.base_url()}</site>
- <textlimit>#{Keyword.get(@instance, :limit)}</textlimit>
- <closed>#{!Keyword.get(@instance, :registrations_open)}</closed>
+ <textlimit>#{Keyword.get(instance, :limit)}</textlimit>
+ <closed>#{!Keyword.get(instance, :registrations_open)}</closed>
</site>
</config>
"""
@@ -157,32 +158,32 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
_ ->
data = %{
- name: Keyword.get(@instance, :name),
- description: Keyword.get(@instance, :description),
+ name: Keyword.get(instance, :name),
+ description: Keyword.get(instance, :description),
server: Web.base_url(),
- textlimit: to_string(Keyword.get(@instance, :limit)),
- closed: if(Keyword.get(@instance, :registrations_open), do: "0", else: "1"),
- private: if(Keyword.get(@instance, :public, true), do: "0", else: "1")
+ textlimit: to_string(Keyword.get(instance, :limit)),
+ closed: if(Keyword.get(instance, :registrations_open), do: "0", else: "1"),
+ private: if(Keyword.get(instance, :public, true), do: "0", else: "1")
}
pleroma_fe = %{
- theme: Keyword.get(@instance_fe, :theme),
- background: Keyword.get(@instance_fe, :background),
- logo: Keyword.get(@instance_fe, :logo),
- logoMask: Keyword.get(@instance_fe, :logo_mask),
- logoMargin: Keyword.get(@instance_fe, :logo_margin),
- redirectRootNoLogin: Keyword.get(@instance_fe, :redirect_root_no_login),
- redirectRootLogin: Keyword.get(@instance_fe, :redirect_root_login),
- chatDisabled: !Keyword.get(@instance_chat, :enabled),
- showInstanceSpecificPanel: Keyword.get(@instance_fe, :show_instance_panel),
- scopeOptionsEnabled: Keyword.get(@instance_fe, :scope_options_enabled),
- formattingOptionsEnabled: Keyword.get(@instance_fe, :formatting_options_enabled),
- collapseMessageWithSubject: Keyword.get(@instance_fe, :collapse_message_with_subject),
- hidePostStats: Keyword.get(@instance_fe, :hide_post_stats),
- hideUserStats: Keyword.get(@instance_fe, :hide_user_stats)
+ theme: Keyword.get(instance_fe, :theme),
+ background: Keyword.get(instance_fe, :background),
+ logo: Keyword.get(instance_fe, :logo),
+ logoMask: Keyword.get(instance_fe, :logo_mask),
+ logoMargin: Keyword.get(instance_fe, :logo_margin),
+ redirectRootNoLogin: Keyword.get(instance_fe, :redirect_root_no_login),
+ redirectRootLogin: Keyword.get(instance_fe, :redirect_root_login),
+ chatDisabled: !Keyword.get(instance_chat, :enabled),
+ showInstanceSpecificPanel: Keyword.get(instance_fe, :show_instance_panel),
+ scopeOptionsEnabled: Keyword.get(instance_fe, :scope_options_enabled),
+ formattingOptionsEnabled: Keyword.get(instance_fe, :formatting_options_enabled),
+ collapseMessageWithSubject: Keyword.get(instance_fe, :collapse_message_with_subject),
+ hidePostStats: Keyword.get(instance_fe, :hide_post_stats),
+ hideUserStats: Keyword.get(instance_fe, :hide_user_stats)
}
- managed_config = Keyword.get(@instance, :managed_config)
+ managed_config = Keyword.get(instance, :managed_config)
data =
if managed_config do
@@ -196,7 +197,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
end
def version(conn, _params) do
- version = Keyword.get(@instance, :version)
+ version = Pleroma.Config.get([:instance, :version])
case get_format(conn) do
"xml" ->