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