endpoint.ex 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. defmodule OpenpodWeb.Endpoint do
  2. use Phoenix.Endpoint, otp_app: :openpod
  3. # The session will be stored in the cookie and signed,
  4. # this means its contents can be read but not tampered with.
  5. # Set :encryption_salt if you would also like to encrypt it.
  6. @session_options [
  7. store: :cookie,
  8. key: "_openpod_key",
  9. signing_salt: "kxzln5AX"
  10. ]
  11. socket "/socket", OpenpodWeb.UserSocket,
  12. websocket: true,
  13. longpoll: false
  14. socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
  15. # Serve at "/" the static files from "priv/static" directory.
  16. #
  17. # You should set gzip to true if you are running phx.digest
  18. # when deploying your static files in production.
  19. plug Plug.Static,
  20. at: "/",
  21. from: :openpod,
  22. gzip: false,
  23. only: ~w(css fonts images js favicon.ico robots.txt)
  24. # Code reloading can be explicitly enabled under the
  25. # :code_reloader configuration of your endpoint.
  26. if code_reloading? do
  27. socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
  28. plug Phoenix.LiveReloader
  29. plug Phoenix.CodeReloader
  30. # plug Phoenix.Ecto.CheckRepoStatus, otp_app: :openpod
  31. end
  32. plug Phoenix.LiveDashboard.RequestLogger,
  33. param_key: "request_logger",
  34. cookie_key: "request_logger"
  35. plug Plug.RequestId
  36. plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
  37. plug Plug.Parsers,
  38. parsers: [:urlencoded, :multipart, :json],
  39. pass: ["*/*"],
  40. json_decoder: Phoenix.json_library()
  41. plug Plug.MethodOverride
  42. plug Plug.Head
  43. plug Plug.Session, @session_options
  44. plug OpenpodWeb.Router
  45. end