Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F77200
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
View Options
diff --git a/lib/lsg/application.ex b/lib/lsg/application.ex
index 5dd9d9c..5b62dcd 100644
--- a/lib/lsg/application.ex
+++ b/lib/lsg/application.ex
@@ -1,54 +1,55 @@
defmodule LSG.Application do
use Application
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec
+ Logger.add_backend(Sentry.LoggerBackend)
:ok = LSG.Matrix.setup()
:ok = LSG.TelegramRoom.setup()
# Define workers and child supervisors to be supervised
children = [
# Start the endpoint when the application starts
supervisor(LSGWeb.Endpoint, []),
# Start your own worker by calling: LSG.Worker.start_link(arg1, arg2, arg3)
# worker(LSG.Worker, [arg1, arg2, arg3]),
worker(Registry, [[keys: :duplicate, name: LSG.BroadcastRegistry]], id: :registry_broadcast),
worker(LSG.IcecastAgent, []),
worker(LSG.Token, []),
worker(LSG.AuthToken, []),
{GenMagic.Pool, [name: LSG.GenMagic, pool_size: 2]},
#worker(LSG.Icecast, []),
] ++ LSG.IRC.application_childs
++ LSG.Matrix.application_childs
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: LSG.Supervisor]
sup = Supervisor.start_link(children, opts)
start_telegram()
spawn_link(fn() -> LSG.IRC.after_start() end)
spawn_link(fn() -> LSG.Matrix.after_start() end)
spawn_link(fn() -> LSG.TelegramRoom.after_start() end)
sup
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
LSGWeb.Endpoint.config_change(changed, removed)
:ok
end
defp start_telegram() do
token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
options = [
username: Keyword.get(Application.get_env(:lsg, :telegram, []), :nick, "beauttebot"),
purge: false
]
telegram = Telegram.Bot.ChatBot.Supervisor.start_link({LSG.Telegram, token, options})
end
end
diff --git a/lib/lsg_web/endpoint.ex b/lib/lsg_web/endpoint.ex
index 4dd8151..bfd53c8 100644
--- a/lib/lsg_web/endpoint.ex
+++ b/lib/lsg_web/endpoint.ex
@@ -1,60 +1,62 @@
defmodule LSGWeb.Endpoint do
+ use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :lsg
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/", from: :lsg, gzip: false,
only: ~w(assets css js fonts images favicon.ico robots.txt)
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if 42==43 && code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
end
plug Plug.RequestId
plug Plug.Logger
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
- json_decoder: Poison
+ json_decoder: Jason
+ plug Sentry.PlugContext
plug Plug.MethodOverride
plug Plug.Head
@session_options [store: :cookie,
key: "_lsg_key",
signing_salt: "+p7K3wrj"]
socket "/live", Phoenix.LiveView.Socket,
websocket: [connect_info: [session: @session_options]]
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
plug Plug.Session, @session_options
plug LSGWeb.Router
@doc """
Callback invoked for dynamically configuring the endpoint.
It receives the endpoint configuration and checks if
configuration should be loaded from the system environment.
"""
def init(_key, config) do
if config[:load_from_system_env] do
port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
{:ok, Keyword.put(config, :http, [:inet6, port: port])}
else
{:ok, config}
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 5, 8:53 PM (2 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
49768
Default Alt Text
(4 KB)
Attached To
rNOLA Nola
Event Timeline
Log In to Comment