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
|
defmodule LSG.IRC do
require Logger
def application_childs do
env = Application.get_env(:lsg, :irc)
import Supervisor.Spec
IRC.Connection.setup()
IRC.Plugin.setup()
# Probably just needed for migration
#for plugin <- Application.get_env(:lsg, :irc)[:plugins], do: IRC.Plugin.declare(plugin)
[
worker(Registry, [[keys: :duplicate, name: IRC.ConnectionPubSub]], id: :registr_irc_conn),
worker(Registry, [[keys: :duplicate, name: IRC.PubSub]], id: :registry_irc),
worker(IRC.Membership, []),
worker(IRC.Account, []),
worker(IRC.UserTrack.Storage, []),
worker(IRC.Account.AccountPlugin, []),
supervisor(IRC.Plugin.Supervisor, [], [name: IRC.Plugin.Supervisor]),
supervisor(IRC.Connection.Supervisor, [], [name: IRC.Connection.Supervisor]),
supervisor(IRC.PuppetConnection.Supervisor, [], [name: IRC.PuppetConnection.Supervisor]),
]
end
def after_start() do
# Start plugins first to let them get on connection events.
Logger.debug("IRC.after_start - initializing plugins")
IRC.Plugin.start_all()
Logger.debug("IRC.after_start - initializing connections")
IRC.Connection.start_all()
Logger.debug("IRC.after_start - ok")
end
end
|