Hello everybody,
I’m following a somehow old tutorial about Phoenix (Getting Started with Phoenix from Pluralsight) where ecto isn’t used within phoenix but rather in a regular elixir app under an umbrella app.
Here are the basic steps I did:
> mix new my_app_umbrella
> cd my_app_umbrella/apps
> mix phx.new my_web_app --no-ecto
> mix new my_app --sup
I’m stumbling on weird configs related errors right at the beginning (I’m using the latest version of Elixir/Phoenix/Ecto).
Both the Phoenix app and the Elixir/Ecto apps were correctly generated using mix
under the umbrella app (say at ~/app_umbrella
) since I’m correctly getting the following lines on both mix.exs
files of the subapps:
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
… as it is explained here in the guides (https://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-projects.html)
So I understood that every configuration of the subapps should reside on the umbrella app config file (at as it’s explained in the top comment of the config.exs
file of the umbrella app):
# This file is responsible for configuring your umbrella
# and **all applications** and their dependencies with the
# help of the Config module.
As a side note, is it fine to have every subapps configuration mixed up in the same parent/umbrella config file?
And Mix
didn’t even generated a config folder in the supapp which somehow makes sense regarding what I understood so far)
However, all the config files that Phoenix generated are still located on its own config
directory (eg. in ~/app_umbrella/apps/my_web_app/config
.
And then I’m having some weird warnings (e.g. regarding Poison since the fact Jason is declared on the config.exs
file from the local Phoenix config
folder…)
So I try to move everything from ~/app_umbrella/apps/my_web_app/config/config.exs
to the umbrella app in ~/app_umbrella/config/config.exs
, but this doesn’t work unless I move everything (like the environment config files such as dev.exs
files, etc.)
But this sounds weird to me… Am I missing something?
[ Edit 1: Also, I forgot to mention, the “import” statement isn’t even the same…
On the umbrella config.exs
this is the first statement: import Config
.
While on the Phoenix config.exs
this is the first statement: use Mix.Config
What are the differences, which one should I keep, if I move everything from ~/app_umbrella/apps/my_web_app/config
to ~/app_umbrella/config
? ]
Do you know what’s the best way to have this setup (Phoenix without ecto, and elixir with ecto) under an umbrella app?
Thank you very much…
NB: Not sure if it’s more a Phoenix related stuff or an Elixir one…
[ Edit 2: When I’m trying to generate the configuration file of ecto like so:
~/app_umbrella/apps/my_app> mix ecto.gen.repo -r MyApp.Repo
I’m getting an error about config.exs
not existing…
It seems that the paths defined on the mix.exs
files aren’t taken into account… ]