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