-
Notifications
You must be signed in to change notification settings - Fork 75
/
dev.exs
84 lines (69 loc) · 1.93 KB
/
dev.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Logger.configure(level: :debug)
Application.ensure_all_started(:exq_scheduler)
# Configures the endpoint
Application.put_env(:exq_ui, DemoWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "JUrii8hEdYZjAo/LHUziUO1xx0ViDK+I1yYDVvNrLpcYWH93l4kSBvWsbfGwJRu5",
live_view: [signing_salt: "jhwmDSe0"],
http: [port: System.get_env("PORT") || 4000],
debug_errors: true,
check_origin: false,
pubsub_server: ExqUI.PubSub,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
System.get_env("NODE_ENV") || "production",
"--watch-options-stdin",
cd: "assets"
]
],
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"lib/exq_ui_web/(live|views)/.*(ex)$",
~r"lib/exq_ui_web/templates/.*(ex)$"
]
]
)
Application.put_env(:phoenix, :serve_endpoints, true)
defmodule DemoWeb.Router do
use Phoenix.Router
import ExqUIWeb.Router
pipeline :browser do
plug :fetch_session
plug :protect_from_forgery
end
scope "/", DemoWeb do
pipe_through :browser
live_exq_ui("/exq", live_socket_path: "/exq/live")
end
end
defmodule DemoWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :exq_ui
@session_options [
store: :cookie,
key: "_exq_ui_key",
signing_salt: "Y3AT90O7"
]
socket "/exq/live", Phoenix.LiveView.Socket,
websocket: [connect_info: [session: @session_options]]
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
plug Plug.RequestId
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
plug Plug.Session, @session_options
plug DemoWeb.Router
end
Task.async(fn ->
children = [
{Phoenix.PubSub, name: ExqUI.PubSub},
DemoWeb.Endpoint
]
{:ok, _} = Supervisor.start_link(children, strategy: :one_for_one)
Process.sleep(:infinity)
end)