Merge branch 'oauth2' into 'develop'
[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 plug Plug.Static,
13 at: "/", from: :pleroma,
14 only: ~w(index.html static finmoji)
15
16 # Code reloading can be explicitly enabled under the
17 # :code_reloader configuration of your endpoint.
18 if code_reloading? do
19 plug Phoenix.CodeReloader
20 end
21
22 plug TrailingFormatPlug
23 plug Plug.RequestId
24 plug Plug.Logger
25
26 plug Plug.Parsers,
27 parsers: [:urlencoded, :multipart, :json],
28 pass: ["*/*"],
29 json_decoder: Poison
30
31 plug Plug.MethodOverride
32 plug Plug.Head
33
34 # The session will be stored in the cookie and signed,
35 # this means its contents can be read but not tampered with.
36 # Set :encryption_salt if you would also like to encrypt it.
37 plug Plug.Session,
38 store: :cookie,
39 key: "_pleroma_key",
40 signing_salt: "CqaoopA2"
41
42 plug Pleroma.Web.Router
43
44 @doc """
45 Dynamically loads configuration from the system environment
46 on startup.
47
48 It receives the endpoint configuration from the config files
49 and must return the updated configuration.
50 """
51 def load_from_system_env(config) do
52 port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
53 {:ok, Keyword.put(config, :http, [:inet6, port: port])}
54 end
55 end