diff options
Diffstat (limited to 'lib/matrix_app_service/application.ex')
-rw-r--r-- | lib/matrix_app_service/application.ex | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/matrix_app_service/application.ex b/lib/matrix_app_service/application.ex index ae935eb..408d5ab 100644 --- a/lib/matrix_app_service/application.ex +++ b/lib/matrix_app_service/application.ex @@ -18,16 +18,20 @@ defmodule MatrixAppService.Application do ] children = - if start_endpoint?() do - [ - # MatrixAppServiceWeb.Endpoint - {MatrixAppServiceWeb.Endpoint, endpoint_config()}, + if start_endpoint?(), + do: [ + {MatrixAppServiceWeb.Endpoint, endpoint_config()} + | children + ], + else: children + + children = + if start_repo?(), + do: [ MatrixAppService.Repo | children - ] - else - children - end + ], + else: children # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options @@ -49,6 +53,10 @@ defmodule MatrixAppService.Application do Application.get_env(:matrix_app_service, :internal_supervisor, false) end + def start_repo?() do + Application.get_env(:matrix_app_service, :internal_repo, false) + end + def endpoint_config() do [ transaction_adapter: Application.fetch_env!(:matrix_app_service, :transaction_adapter), |