From 61b778d78de2eae5a66237db98a172715cce8405 Mon Sep 17 00:00:00 2001 From: 5HT Date: Thu, 14 Nov 2024 23:03:01 +0200 Subject: [PATCH] remove port numbers from code --- lib/application.ex | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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