summaryrefslogtreecommitdiff
path: root/lib/nola/application.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nola/application.ex')
-rw-r--r--lib/nola/application.ex49
1 files changed, 26 insertions, 23 deletions
diff --git a/lib/nola/application.ex b/lib/nola/application.ex
index d56d4cb..fc51c2c 100644
--- a/lib/nola/application.ex
+++ b/lib/nola/application.ex
@@ -4,39 +4,41 @@ defmodule Nola.Application do
def start(_type, _args) do
import Supervisor.Spec
- Logger.add_backend(Sentry.LoggerBackend)
-
Nola.Plugins.setup()
:ok = Nola.Matrix.setup()
:ok = Nola.TelegramRoom.setup()
# Define workers and child supervisors to be supervised
- children = [
- supervisor(NolaWeb.Endpoint, []),
- worker(Registry, [[keys: :duplicate, name: Nola.BroadcastRegistry]], id: :registry_broadcast),
- worker(Nola.IcecastAgent, []),
- worker(Nola.Token, []),
- worker(Nola.AuthToken, []),
- Nola.Subnet,
- {GenMagic.Pool, [name: Nola.GenMagic, pool_size: 2]},
- worker(Registry, [[keys: :duplicate, name: Nola.PubSub]], id: :registry_nola_pubsub),
- worker(Nola.Membership, []),
- worker(Nola.Account, []),
- worker(Nola.UserTrack.Storage, []),
- worker(Nola.Plugins.Account, []),
- supervisor(Nola.Plugins.Supervisor, [], [name: Nola.Plugins.Supervisor]),
- ] ++ Nola.Irc.application_childs
- ++ Nola.Matrix.application_childs
+ children =
+ [
+ supervisor(NolaWeb.Endpoint, []),
+ worker(Registry, [[keys: :duplicate, name: Nola.BroadcastRegistry]],
+ id: :registry_broadcast
+ ),
+ worker(Nola.IcecastAgent, []),
+ worker(Nola.Token, []),
+ worker(Nola.AuthToken, []),
+ Nola.Subnet,
+ {GenMagic.Pool, [name: Nola.GenMagic, pool_size: 2]},
+ worker(Registry, [[keys: :duplicate, name: Nola.PubSub]], id: :registry_nola_pubsub),
+ worker(Nola.Membership, []),
+ worker(Nola.Account, []),
+ worker(Nola.UserTrack.Storage, []),
+ worker(Nola.Plugins.Account, []),
+ supervisor(Nola.Plugins.Supervisor, [], name: Nola.Plugins.Supervisor)
+ ] ++
+ Nola.Irc.application_childs() ++
+ Nola.Matrix.application_childs()
opts = [strategy: :one_for_one, name: Nola.Supervisor]
sup = Supervisor.start_link(children, opts)
-
+
start_telegram()
Nola.Plugins.start_all()
- spawn_link(fn() -> Nola.Irc.after_start() end)
- spawn_link(fn() -> Nola.Matrix.after_start() end)
- spawn_link(fn() -> Nola.TelegramRoom.after_start() end)
+ spawn_link(fn -> Nola.Irc.after_start() end)
+ spawn_link(fn -> Nola.Matrix.after_start() end)
+ spawn_link(fn -> Nola.TelegramRoom.after_start() end)
sup
end
@@ -47,11 +49,12 @@ defmodule Nola.Application do
defp start_telegram() do
token = Keyword.get(Application.get_env(:nola, :telegram, []), :key)
+
options = [
username: Keyword.get(Application.get_env(:nola, :telegram, []), :nick, "beauttebot"),
purge: false
]
+
telegram = Telegram.Bot.ChatBot.Supervisor.start_link({Nola.Telegram, token, options})
end
-
end