aboutsummaryrefslogtreecommitdiff
path: root/server/src/jchat_sup.erl
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2025-09-03 21:15:36 -0400
committerCalvin Morrison <calvin@pobox.com>2025-09-03 21:15:36 -0400
commit49fa5aa2a127bdf8924d02bf77e5086b39c7a447 (patch)
tree61d86a7705dacc9fddccc29fa79d075d83ab8059 /server/src/jchat_sup.erl
i vibe coded itHEADmaster
Diffstat (limited to 'server/src/jchat_sup.erl')
-rw-r--r--server/src/jchat_sup.erl50
1 files changed, 50 insertions, 0 deletions
diff --git a/server/src/jchat_sup.erl b/server/src/jchat_sup.erl
new file mode 100644
index 0000000..cbb61ba
--- /dev/null
+++ b/server/src/jchat_sup.erl
@@ -0,0 +1,50 @@
+-module(jchat_sup).
+-behaviour(supervisor).
+
+-export([start_link/0, init/1]).
+
+start_link() ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+init([]) ->
+ % Initialize database
+ jchat_db:init(),
+
+ % Child specifications
+ Children = [
+ % HTTP server
+ #{
+ id => jchat_http,
+ start => {jchat_http, start_link, []},
+ restart => permanent,
+ shutdown => 5000,
+ type => worker,
+ modules => [jchat_http]
+ },
+ % Push notification manager
+ #{
+ id => jchat_push,
+ start => {jchat_push, start_link, []},
+ restart => permanent,
+ shutdown => 5000,
+ type => worker,
+ modules => [jchat_push]
+ },
+ % Presence manager
+ #{
+ id => jchat_presence,
+ start => {jchat_presence, start_link, []},
+ restart => permanent,
+ shutdown => 5000,
+ type => worker,
+ modules => [jchat_presence]
+ }
+ ],
+
+ SupFlags = #{
+ strategy => one_for_one,
+ intensity => 10,
+ period => 60
+ },
+
+ {ok, {SupFlags, Children}}.