@impl true
def start(_type, _args) do
+ opts = [port: :integer]
+ {parsed, _, _} = OptionParser.parse(System.argv(), strict: opts)
+
children = [
- # TODO: Fetch the port from command line
- {DnsPhrases.Server, [listen_port: 3069]},
- {Postgrex, [name: :db]}
+ {Postgrex, [name: :db]},
+ {DnsPhrases.Server, [listen_port: parsed[:port]]}
]
- # See https://hexdocs.pm/elixir/Supervisor.html
- # for other strategies and supported options
opts = [strategy: :one_for_one, name: DnsPhrases.Supervisor]
Supervisor.start_link(children, opts)
end