Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/user-timeline
[akkoma] / lib / pleroma / web / endpoint.ex
1 defmodule Pleroma.Web.Endpoint do
2 use Phoenix.Endpoint, otp_app: :pleroma
3
4 socket "/socket", Pleroma.Web.UserSocket
5
6 # Serve at "/" the static files from "priv/static" directory.
7 #
8 # You should set gzip to true if you are running phoenix.digest
9 # when deploying your static files in production.
10 plug Plug.Static,
11 at: "/media", from: "uploads", gzip: false
12
13 # Code reloading can be explicitly enabled under the
14 # :code_reloader configuration of your endpoint.
15 if code_reloading? do
16 plug Phoenix.CodeReloader
17 end
18
19 plug TrailingFormatPlug
20 plug Plug.RequestId
21 plug Plug.Logger
22
23 plug Plug.Parsers,
24 parsers: [:urlencoded, :multipart, :json],
25 pass: ["*/*"],
26 json_decoder: Poison
27
28 plug Plug.MethodOverride
29 plug Plug.Head
30
31 # The session will be stored in the cookie and signed,
32 # this means its contents can be read but not tampered with.
33 # Set :encryption_salt if you would also like to encrypt it.
34 plug Plug.Session,
35 store: :cookie,
36 key: "_pleroma_key",
37 signing_salt: "CqaoopA2"
38
39 plug Pleroma.Web.Router
40
41 @doc """
42 Dynamically loads configuration from the system environment
43 on startup.
44
45 It receives the endpoint configuration from the config files
46 and must return the updated configuration.
47 """
48 def load_from_system_env(config) do
49 port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
50 {:ok, Keyword.put(config, :http, [:inet6, port: port])}
51 end
52 end