docker-pleroma/config.dist.exs

68 lines
2.3 KiB
Elixir

import Config
config :pleroma, Pleroma.Web.Endpoint,
url: [host: System.get_env("DOMAIN", "localhost"), scheme: System.get_env("SCHEME", "http"), port: System.get_env("PORT", "8001")],
http: [ip: {0, 0, 0, 0}, port: 4000]
config :pleroma, :instance,
name: System.get_env("INSTANCE_NAME", "Pleroma"),
email: System.get_env("ADMIN_EMAIL", "info@example.com"),
notify_email: System.get_env("NOTIFY_EMAIL", "info@example.com"),
limit: 5000,
registrations_open: true,
federating: true,
healthcheck: true
config :pleroma, :media_proxy,
enabled: false,
redirect_on_failure: true,
base_url: "https://cache.domain.tld"
config :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
username: System.get_env("POSTGRES_USER", "pleroma"),
password: System.fetch_env!("POSTGRES_PASSWORD"),
database: System.get_env("POSTGRES_DB", "pleroma"),
hostname: System.get_env("POSTGRES_HOST", "postgres"),
pool_size: 10
config :web_push_encryption, :vapid_details, subject: "mailto:#{System.get_env("NOTIFY_EMAIL")}"
config :pleroma, :database, rum_enabled: false
config :pleroma, :instance, static_dir: "/static"
config :pleroma, Pleroma.Uploaders.Local, uploads: "/uploads"
if not File.exists?("/config/secret.exs") do
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)
secret_file =
EEx.eval_string(
"""
import Config
config :pleroma, Pleroma.Web.Endpoint,
secret_key_base: "<%= secret %>",
signing_salt: "<%= signing_salt %>"
config :web_push_encryption, :vapid_details,
public_key: "<%= web_push_public_key %>",
private_key: "<%= web_push_private_key %>"
""",
secret: secret,
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)
)
File.write("/config/secret.exs", secret_file)
end
import_config("/config/secret.exs")
# For additional user config
if File.exists?("/config/config-override.exs") do
import_config("/config/config-override.exs")
end