Files
archived-hipudding-teslamate/lib/teslamate_web/endpoint.ex
marvelm da819054f6 feat: Upgrade web development framework to Phoenix 1.7 (#3615)
* Upgrade to phoenix 1.7.0
The minimal changes necessary to compile the application

* Import Phoenix.Component instead of LiveView

* Fix compilation warnings

* mix format

* Update tests to trim newline characters

* mix gettext.extract --merge

* style: correct linting

* rebuild gettext

* fix: correct spacing before unit for energy added

* fix: use unicode character for whitespace

* fix: spacing with witespace

* fix: use numeric value for charge_energy_added in charging test

* fix: avoid warning about unsued function, which is actually used in plug

* fix: use whitespace in test before charge_energy_added

---------

Co-authored-by: JakobLichterfeld <jakob-lichterfeld@gmx.de>
2024-02-07 19:23:53 +01:00

44 lines
1.1 KiB
Elixir

defmodule TeslaMateWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :teslamate
@session_options [
store: :cookie,
key: "_teslamate_key",
signing_salt: "yt5O3CAQ",
same_site: "Strict"
]
plug TeslaMateWeb.HealthCheck
socket "/live", Phoenix.LiveView.Socket,
websocket: [connect_info: [session: @session_options], transport_log: :debug]
plug Plug.Static,
at: "/",
from: :teslamate,
gzip: true,
only: TeslaMateWeb.static_paths()
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :teslamate
end
plug Plug.RequestId
plug Plug.Logger
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
plug Plug.MethodOverride
plug Plug.Head
plug Plug.Session, @session_options
plug TeslaMateWeb.Router
end