Add Kocaptcha endpoint to the test config
[akkoma] / config / docker.exs
1 import Config
2
3 config :pleroma, Pleroma.Web.Endpoint,
4 url: [host: System.get_env("DOMAIN", "localhost"), scheme: "https", port: 443],
5 http: [ip: {0, 0, 0, 0}, port: 4000]
6
7 config :pleroma, :instance,
8 name: System.get_env("INSTANCE_NAME", "Pleroma"),
9 email: System.get_env("ADMIN_EMAIL"),
10 notify_email: System.get_env("NOTIFY_EMAIL"),
11 limit: 5000,
12 registrations_open: false,
13 healthcheck: true
14
15 config :pleroma, Pleroma.Repo,
16 adapter: Ecto.Adapters.Postgres,
17 username: System.get_env("DB_USER", "pleroma"),
18 password: System.fetch_env!("DB_PASS"),
19 database: System.get_env("DB_NAME", "pleroma"),
20 hostname: System.get_env("DB_HOST", "db"),
21 pool_size: 10
22
23 # Configure web push notifications
24 config :web_push_encryption, :vapid_details, subject: "mailto:#{System.get_env("NOTIFY_EMAIL")}"
25
26 config :pleroma, :database, rum_enabled: false
27 config :pleroma, :instance, static_dir: "/var/lib/pleroma/static"
28 config :pleroma, Pleroma.Uploaders.Local, uploads: "/var/lib/pleroma/uploads"
29
30 # We can't store the secrets in this file, since this is baked into the docker image
31 if not File.exists?("/var/lib/pleroma/secret.exs") do
32 secret = :crypto.strong_rand_bytes(64) |> Base.encode64() |> binary_part(0, 64)
33 signing_salt = :crypto.strong_rand_bytes(8) |> Base.encode64() |> binary_part(0, 8)
34 {web_push_public_key, web_push_private_key} = :crypto.generate_key(:ecdh, :prime256v1)
35
36 secret_file =
37 EEx.eval_string(
38 """
39 import Config
40
41 config :pleroma, Pleroma.Web.Endpoint,
42 secret_key_base: "<%= secret %>",
43 signing_salt: "<%= signing_salt %>"
44
45 config :web_push_encryption, :vapid_details,
46 public_key: "<%= web_push_public_key %>",
47 private_key: "<%= web_push_private_key %>"
48 """,
49 secret: secret,
50 signing_salt: signing_salt,
51 web_push_public_key: Base.url_encode64(web_push_public_key, padding: false),
52 web_push_private_key: Base.url_encode64(web_push_private_key, padding: false)
53 )
54
55 File.write("/var/lib/pleroma/secret.exs", secret_file)
56 end
57
58 import_config("/var/lib/pleroma/secret.exs")
59
60 # For additional user config
61 if File.exists?("/var/lib/pleroma/config.exs"),
62 do: import_config("/var/lib/pleroma/config.exs"),
63 else:
64 File.write("/var/lib/pleroma/config.exs", """
65 import Config
66
67 # For additional configuration outside of environmental variables
68 """)