1 defmodule Pleroma.Web.Endpoint do
2 use Phoenix.Endpoint, otp_app: :pleroma
4 socket("/socket", Pleroma.Web.UserSocket)
6 # Serve at "/" the static files from "priv/static" directory.
8 # You should set gzip to true if you are running phoenix.digest
9 # when deploying your static files in production.
11 plug(Pleroma.Plugs.HTTPSecurityPlug)
13 plug(Pleroma.Plugs.UploadedMedia)
20 ~w(index.html static finmoji emoji packs sounds images instance sw.js favicon.png schemas)
23 # Code reloading can be explicitly enabled under the
24 # :code_reloader configuration of your endpoint.
26 plug(Phoenix.CodeReloader)
29 plug(TrailingFormatPlug)
35 parsers: [:urlencoded, :multipart, :json],
38 length: Application.get_env(:pleroma, :instance) |> Keyword.get(:upload_limit),
39 body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []}
42 plug(Plug.MethodOverride)
46 if Application.get_env(:pleroma, Pleroma.Web.Endpoint) |> Keyword.get(:secure_cookie_flag),
47 do: "__Host-pleroma_key",
50 # The session will be stored in the cookie and signed,
51 # this means its contents can be read but not tampered with.
52 # Set :encryption_salt if you would also like to encrypt it.
57 signing_salt: {Pleroma.Config, :get, [[__MODULE__, :signing_salt], "CqaoopA2"]},
60 Application.get_env(:pleroma, Pleroma.Web.Endpoint) |> Keyword.get(:secure_cookie_flag),
61 extra: "SameSite=Strict"
64 plug(Pleroma.Web.Router)
67 Dynamically loads configuration from the system environment
70 It receives the endpoint configuration from the config files
71 and must return the updated configuration.
73 def load_from_system_env(config) do
74 port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
75 {:ok, Keyword.put(config, :http, [:inet6, port: port])}