mirror of
https://github.com/Retropex/bitfeed.git
synced 2025-05-12 19:20:46 +02:00
41 lines
1.0 KiB
Elixir
41 lines
1.0 KiB
Elixir
defmodule BitcoinStream.Server do
|
|
use Application
|
|
|
|
def start(_type, _args) do
|
|
children = [
|
|
{ BitcoinStream.BlockData, [name: :block_data] },
|
|
{ BitcoinStream.Mempool, [port: 9959, name: :mempool] },
|
|
BitcoinStream.Metrics.Probe,
|
|
Plug.Cowboy.child_spec(
|
|
scheme: :http,
|
|
plug: BitcoinStream.Router,
|
|
options: [
|
|
dispatch: dispatch(),
|
|
port: 4000
|
|
]
|
|
),
|
|
Registry.child_spec(
|
|
keys: :duplicate,
|
|
name: Registry.BitcoinStream
|
|
),
|
|
BitcoinStream.Bridge.child_spec(port: 29000),
|
|
BitcoinStream.Donations.Lightning.child_spec()
|
|
]
|
|
|
|
opts = [strategy: :one_for_one, name: BitcoinStream.Application]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
defp dispatch do
|
|
[
|
|
{:_,
|
|
[
|
|
{"/ws/txs", BitcoinStream.SocketHandler, []},
|
|
{"/ws/status", BitcoinStream.Metrics.SocketHandler, []},
|
|
{:_, Plug.Cowboy.Handler, {BitcoinStream.Router, []}}
|
|
]
|
|
}
|
|
]
|
|
end
|
|
end
|