Skip to content

Commit 4b339ba

Browse files
authored
Support loading ecto conditionally
Including graphql_relay in projects which do not use ecto causes problems, because the ecto dependency here is only required for test, and is not installed by Mix by default when including graphql_relay as a dependency. This means that the application won't boot, as it can't find :ecto on launch.
1 parent 6fd5662 commit 4b339ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mix.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ defmodule GraphQL.Relay.Mixfile do
2222

2323
def application do
2424
[
25-
applications: [:logger, :ecto],
25+
applications: applications(Mix.env),
2626
env: [
2727
schema_module: StarWars.Schema, # Module with a .schema function that returns your GraphQL schema
2828
schema_json_path: "./schema.json"
2929
]
3030
]
3131
end
32+
33+
defp applications(:test), do: applications(:prod) ++ [:ecto]
34+
defp applications(:dev), do: applications(:prod) ++ [:ecto]
35+
defp applications(_), do: [:logger]
3236

3337
defp deps do
3438
[

0 commit comments

Comments
 (0)