diff options
author | Arjun Satarkar <me@arjunsatarkar.net> | 2024-07-17 13:41:06 +0000 |
---|---|---|
committer | Arjun Satarkar <me@arjunsatarkar.net> | 2024-07-17 13:41:06 +0000 |
commit | 06f7696c0976c75c13435f84a2101c1203c18b95 (patch) | |
tree | 9ea52c784f4bc5013c8e8af32e82c0a497889b32 /lib/mediasync/application.ex | |
download | mediasync-06f7696c0976c75c13435f84a2101c1203c18b95.tar mediasync-06f7696c0976c75c13435f84a2101c1203c18b95.tar.gz mediasync-06f7696c0976c75c13435f84a2101c1203c18b95.zip |
Initial commit
Diffstat (limited to 'lib/mediasync/application.ex')
-rw-r--r-- | lib/mediasync/application.ex | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/mediasync/application.ex b/lib/mediasync/application.ex new file mode 100644 index 0000000..1e8f6d4 --- /dev/null +++ b/lib/mediasync/application.ex @@ -0,0 +1,35 @@ +defmodule Mediasync.Application do + # See https://hexdocs.pm/elixir/Application.html + # for more information on OTP Applications + @moduledoc false + + use Application + + @impl true + def start(_type, _args) do + children = [ + # Starts a worker by calling: Mediasync.Worker.start_link(arg) + # {Mediasync.Worker, arg} + {Bandit, + plug: Mediasync.Router, + scheme: :http, + ip: {127, 0, 0, 1}, + port: Application.get_env(:mediasync, :port)}, + {DynamicSupervisor, + max_children: Application.get_env(:mediasync, :max_rooms), + max_restarts: 0, + strategy: :one_for_one, + name: Mediasync.RoomSupervisor}, + {Registry, keys: :unique, name: Mediasync.RoomRegistry}, + {Registry, keys: :unique, name: Mediasync.RoomConnectionRegistry}, + {Registry, keys: :duplicate, name: Mediasync.RoomSubscriptionRegistry} + ] + + System.no_halt(true) + + # See https://hexdocs.pm/elixir/Supervisor.html + # for other strategies and supported options + opts = [strategy: :one_for_one, name: Mediasync.Supervisor] + Supervisor.start_link(children, opts) + end +end |