summaryrefslogtreecommitdiff
path: root/lib/nola_irc/nola_irc.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nola_irc/nola_irc.ex')
-rw-r--r--lib/nola_irc/nola_irc.ex34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/nola_irc/nola_irc.ex b/lib/nola_irc/nola_irc.ex
new file mode 100644
index 0000000..f64978a
--- /dev/null
+++ b/lib/nola_irc/nola_irc.ex
@@ -0,0 +1,34 @@
+defmodule Nola.IRC do
+ require Logger
+
+ def env(), do: Nola.env(:irc)
+ def env(key, default \\ nil), do: Keyword.get(env(), key, default)
+
+ def application_childs do
+ import Supervisor.Spec
+
+ IRC.Connection.setup()
+ IRC.Plugin.setup()
+
+ [
+ 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
+
+ # Start plugins first to let them get on connection events.
+ def after_start() do
+ Logger.info("Starting plugins")
+ IRC.Plugin.start_all()
+ Logger.info("Starting connections")
+ IRC.Connection.start_all()
+ end
+
+end