File size: 515 Bytes
2e92879
 
 
d007060
 
2e92879
d007060
 
2e92879
89df778
2e92879
 
 
 
 
 
d007060
2e92879
 
 
 
 
 
 
 
 
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
defmodule Srh do
  use Application

  @port Application.fetch_env!(:srh, :port)

  def start(_type, _args) do
    IO.puts("Using port #{@port}")
    
    children = [
      Srh.Auth.TokenResolver,
      {GenRegistry, worker_module: Srh.Redis.Client},
      {
        Plug.Cowboy,
        scheme: :http,
        plug: Srh.Http.BaseRouter,
        options: [
          port: @port
        ]
      }
    ]

    opts = [strategy: :one_for_one, name: Srh.Supervisor]

    Supervisor.start_link(children, opts)
  end
end