diff --git a/lib/application.ex b/lib/application.ex index 714e697..6a27e97 100644 --- a/lib/application.ex +++ b/lib/application.ex @@ -4,15 +4,16 @@ defmodule CA do that runs TCP and HTTP connections under Erlang/OTP supervision. """ use Application + def port(app) do Application.fetch_env!(:ca, app) end def start(_type, _args) do :logger.add_handlers(:ca) Supervisor.start_link([ - { CA.CMP, port: Application.fetch_env!(:ca, :cmp) }, - { CA.CMC, port: Application.fetch_env!(:ca, :cmc) }, - { CA.OCSP, port: Application.fetch_env!(:ca, :ocsp) }, - { CA.TSP, port: Application.fetch_env!(:ca, :tsp) }, - { CA.EST, port: Application.fetch_env!(:ca, :est), plug: CA.EST, - scheme: :http, thousand_island_options: [num_acceptors: 1] } + { CA.CMP, port: port(:cmp) }, + { CA.CMC, port: port(:cmc) }, + { CA.OCSP, port: port(:ocsp) }, + { CA.TSP, port: port(:tsp) }, + { CA.EST, port: port(:est), plug: CA.EST, scheme: :http, + thousand_island_options: [num_acceptors: 1] } ], strategy: :one_for_one, name: CA.Supervisor) end