aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mix/tasks/pleroma/instance.ex28
-rw-r--r--lib/mix/tasks/pleroma/sample_config.eex3
2 files changed, 28 insertions, 3 deletions
diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex
index 1d89827ba..2c4e414cf 100644
--- a/lib/mix/tasks/pleroma/instance.ex
+++ b/lib/mix/tasks/pleroma/instance.ex
@@ -31,6 +31,8 @@ defmodule Mix.Tasks.Pleroma.Instance do
- `--dbpass DBPASS` - the password to use for the database connection
- `--indexable Y/N` - Allow/disallow indexing site by search engines
- `--db-configurable Y/N` - Allow/disallow configuring instance from admin part
+ - `--uploads-dir` - the directory uploads go in when using a local uploader
+ - `--static-dir` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)
"""
def run(["gen" | rest]) do
@@ -50,7 +52,9 @@ defmodule Mix.Tasks.Pleroma.Instance do
dbuser: :string,
dbpass: :string,
indexable: :string,
- db_configurable: :string
+ db_configurable: :string,
+ uploads_dir: :string,
+ static_dir: :string
],
aliases: [
o: :output,
@@ -107,7 +111,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
get_option(
options,
:db_configurable,
- "Do you want to be able to configure instance from admin part? (y/n)",
+ "Do you want to store the configuration in the database (allows controlling it from admin-fe)? (y/n)",
"y"
) === "y"
@@ -132,6 +136,22 @@ defmodule Mix.Tasks.Pleroma.Instance do
"autogenerated"
)
+ uploads_dir =
+ get_option(
+ options,
+ :upload_dir,
+ "What directory should media uploads go in (when using the local uploader)?",
+ Pleroma.Config.get([Pleroma.Uploaders.Local, :uploads])
+ )
+
+ static_dir =
+ get_option(
+ options,
+ :static_dir,
+ "What directory should custom public files be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)?",
+ Pleroma.Config.get([:instance, :static_dir])
+ )
+
secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
signing_salt = :crypto.strong_rand_bytes(8) |> Base.encode64() |> binary_part(0, 8)
{web_push_public_key, web_push_private_key} = :crypto.generate_key(:ecdh, :prime256v1)
@@ -152,7 +172,9 @@ defmodule Mix.Tasks.Pleroma.Instance do
signing_salt: signing_salt,
web_push_public_key: Base.url_encode64(web_push_public_key, padding: false),
web_push_private_key: Base.url_encode64(web_push_private_key, padding: false),
- db_configurable?: db_configurable?
+ db_configurable?: db_configurable?,
+ static_dir: static_dir,
+ uploads_dir: uploads_dir
)
result_psql =
diff --git a/lib/mix/tasks/pleroma/sample_config.eex b/lib/mix/tasks/pleroma/sample_config.eex
index 0c4e49f0d..8b45acb05 100644
--- a/lib/mix/tasks/pleroma/sample_config.eex
+++ b/lib/mix/tasks/pleroma/sample_config.eex
@@ -37,6 +37,9 @@ config :web_push_encryption, :vapid_details,
public_key: "<%= web_push_public_key %>",
private_key: "<%= web_push_private_key %>"
+config :pleroma, :instance, static_dir: "<%= static_dir %>"
+config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>"
+
# Enable Strict-Transport-Security once SSL is working:
# config :pleroma, :http_security,
# sts: true