Background
I have an umbrella project with several apps inside. I want to create a special release that will have additional files inside, like JSON files, configuration, images etc.
I know that in a normal Phoenix project everything inside the priv
folder will be in the release under "#{child-app-name}-#{child-app-version}/priv"
.
Problem
The issue here is that some of my configuration files depend on these assets. So in my config/prod.exs
I have tried several ways to get the path dynamically, bu nothing works. The following examples all fail:
config :my_app,
products: "application-data\\lib\\web_interface-#{Application.spec(:web_interface, :vsn) |> to_string()}\\priv\\persistence\\products.json"
config :my_app,
products: "application-data\\lib\\web_interface-#{WebInterface.Mixfile.project()[:version]}\\priv\\persistence\\products.json"
config :my_app,
products: "application-data\\lib\\web_interface-#{Application.get_application(:web_interface)}\\priv\\persistence\\products.json"
The one that works is as follows:
products: "application-data\\lib\\web_interface-2.2.0\\priv\\persistence\\products.json",
You can see the issue here is that the version number will change from release to release, and I don’t want to change my prod.exs
every time a new release is made.
My solution would be to move the assets I depend on to the root level, so my configuation can access them via "application-data\\assets\\products.json
or something similar.
Questions
Is this possible to achieve, given that I am building a tar
in my release?