Skip to content

Commit

Permalink
fix: service startup now working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerMatt committed Sep 6, 2024
1 parent b71948d commit b935789
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 3 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Config
test_or_dev? = Mix.env() in [:test, :dev]

prod? = Mix.env() == :prod
test? = Mix.env() == :test

# Extra metadata for the logger to keep
stampede_metadata = [
Expand Down Expand Up @@ -97,8 +98,8 @@ config :stampede,
Services.Discord
],
# What will actually be started by stampede
services:
(if test_or_dev? do
services_to_start:
(if test? do
# NOTE: this will have to change if Service-specific tests start making sense
[Services.Dummy]
else
Expand Down
11 changes: 3 additions & 8 deletions lib/stampede/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Stampede.Application do
:error_log_destination,
:config_dir,
:clear_state,
:services_to_install
:services_to_start
]
|> Enum.map(fn key ->
{key, Application.fetch_env!(:stampede, key)}
Expand Down Expand Up @@ -76,13 +76,8 @@ defmodule Stampede.Application do
]

service_tuples =
case Keyword.fetch!(startup_args, :services_to_install) do
:all ->
installed = Keyword.fetch!(startup_args, :installed_services)
Logger.debug("Stampede starting all services: #{inspect(installed)}")
installed

name when is_atom(name) ->
case Keyword.fetch!(startup_args, :services_to_start) do
[name] ->
Logger.debug("Stampede starting only #{name}")
[name]

Expand Down

0 comments on commit b935789

Please sign in to comment.