diff options
Diffstat (limited to 'lib/matrix_app_service/application.ex')
-rw-r--r-- | lib/matrix_app_service/application.ex | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/matrix_app_service/application.ex b/lib/matrix_app_service/application.ex index 383c0f9..408d5ab 100644 --- a/lib/matrix_app_service/application.ex +++ b/lib/matrix_app_service/application.ex @@ -18,15 +18,20 @@ defmodule MatrixAppService.Application do ] children = - if start_endpoint?() do - [ - # MatrixAppServiceWeb.Endpoint + if start_endpoint?(), + do: [ {MatrixAppServiceWeb.Endpoint, endpoint_config()} | children - ] - else - children - end + ], + else: children + + children = + if start_repo?(), + do: [ + MatrixAppService.Repo + | children + ], + else: children # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options @@ -48,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), |