1 defmodule Pleroma.Web.Endpoint do
2 use Phoenix.Endpoint, otp_app: :pleroma
4 if Application.get_env(:pleroma, :chat) |> Keyword.get(:enabled) do
5 socket "/socket", Pleroma.Web.UserSocket
7 socket "/api/v1", Pleroma.Web.MastodonAPI.MastodonSocket
9 # Serve at "/" the static files from "priv/static" directory.
11 # You should set gzip to true if you are running phoenix.digest
12 # when deploying your static files in production.
14 at: "/media", from: "uploads", gzip: false
16 at: "/", from: :pleroma,
17 only: ~w(index.html static finmoji emoji packs sounds images instance sw.js)
19 # Code reloading can be explicitly enabled under the
20 # :code_reloader configuration of your endpoint.
22 plug Phoenix.CodeReloader
25 plug TrailingFormatPlug
30 parsers: [:urlencoded, :multipart, :json],
34 plug Plug.MethodOverride
37 # The session will be stored in the cookie and signed,
38 # this means its contents can be read but not tampered with.
39 # Set :encryption_salt if you would also like to encrypt it.
43 signing_salt: "CqaoopA2"
45 plug Pleroma.Web.Router
48 Dynamically loads configuration from the system environment
51 It receives the endpoint configuration from the config files
52 and must return the updated configuration.
54 def load_from_system_env(config) do
55 port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
56 {:ok, Keyword.put(config, :http, [:inet6, port: port])}