From 157bceeda9124cea7ba69eaf6639ca52b3fac7c6 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Fri, 6 Dec 2019 15:04:46 +0700 Subject: [PATCH] Move runtime configuration from `:instance` to `:modules` --- config/config.exs | 3 ++- config/releases.exs | 1 + docs/configuration/cheatsheet.md | 12 ++++++++++-- lib/pleroma/application.ex | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config/config.exs b/config/config.exs index e1358eda0..64e33c82f 100644 --- a/config/config.exs +++ b/config/config.exs @@ -249,7 +249,6 @@ quarantined_instances: [], managed_config: true, static_dir: "instance/static/", - custom_modules_dir: "instance/modules/", allowed_post_formats: [ "text/plain", "text/html", @@ -618,6 +617,8 @@ activity_pub: nil, activity_pub_question: 30_000 +config :pleroma, :modules, runtime_dir: "instance/modules" + config :swarm, node_blacklist: [~r/myhtml_.*$/] # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. diff --git a/config/releases.exs b/config/releases.exs index 98c5ceccd..b224960db 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -2,6 +2,7 @@ config :pleroma, :instance, static_dir: "/var/lib/pleroma/static" config :pleroma, Pleroma.Uploaders.Local, uploads: "/var/lib/pleroma/uploads" +config :pleroma, :modules, runtime_dir: "/var/lib/pleroma/modules" config_path = System.get_env("PLEROMA_CONFIG_PATH") || "/etc/pleroma/config.exs" diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index f73d368c1..413a668c6 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -68,8 +68,6 @@ You shouldn't edit the base config directly to avoid breakages and merge conflic * `account_field_name_length`: An account field name maximum length (default: `512`). * `account_field_value_length`: An account field value maximum length (default: `2048`). * `external_user_synchronization`: Enabling following/followers counters synchronization for external users. -* `custom_modules_dir`: A path to custom Elixir modules (such as MRF policies). - !!! danger This is a Work In Progress, not usable just yet @@ -831,3 +829,13 @@ config :auto_linker, rel: "ugc" ] ``` + +## Custom Runtime Modules (`:modules`) + +* `runtime_dir`: A path to custom Elixir modules (such as MRF policies). + +Example: + +```elixir +config :pleroma, :modules, runtime_dir: "/var/lib/pleroma/modules" +``` diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 73364f141..9d2f3f320 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -69,7 +69,7 @@ def start(_type, _args) do end def load_custom_modules do - dir = Pleroma.Config.get([:instance, :custom_modules_dir]) + dir = Pleroma.Config.get([:modules, :runtime_dir]) if dir && File.exists?(dir) do dir