Allow setting upload/static directories in the config generator
This commit is contained in:
parent
144e2e3e0b
commit
69070e641d
@ -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 @@ def run(["gen" | rest]) 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 @@ def run(["gen" | rest]) 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 @@ def run(["gen" | rest]) 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 @@ def run(["gen" | rest]) 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 =
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user