Verified Commit 36322732 authored by Pierre de Lacroix's avatar Pierre de Lacroix
Browse files

dont' start the repo unless necessary

parent 00c21255
Pipeline #227233287 failed with stage
in 3 minutes and 50 seconds
......@@ -23,6 +23,7 @@ config :logger, level: :warn
config :matrix_app_service,
internal_supervisor: true,
internal_repo: true,
transaction_adapter: MatrixAppService.TestTransactionAdapter,
room_adapter: MatrixAppService.TestRoomAdapter,
user_adapter: MatrixAppService.TestUserAdapter,
......
......@@ -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),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment