I don’t quite like the way Elixir handles configuration or maybe I got it wrong. Let’s suppose my app need to use the messagebird dependency which has a config like this:
token: "YOUR API TOKEN",
What if I would like to hide this from the user? There is any way to force this config through my own configuration section? Like this:
token: "YOUR API TOKEN"
I don’t want to expose the dependency configuration to the outside world.
What do you want to hide from which user?
Also if you can “consumer” some configuration with your application and use it to configure your dependencies, depends on how the library works.
Though it is strongly discouraged to solely rely on the application environment and not giving any alternatives.
I was mainly thinking on simply hiding the initialisation of the other libs from the user. But maybe this is way too much anti pattern on Elixir as each library can be its own application running independent. It’s hard to break the pattern from other languages…
You have still not made clear what or who the user is, but to make one thing clear: libs can not only be applications, they are applications from the BEAM side of view.
I think that the confusion here is who you are considering to be the end-user. I personally wouldn’t consider someone with the source code in hand an end-user unless we are talking about developers (at least in the way I think you meant). Therefore, this person would be able able to modify and by extension, change the configuration of the application.
However, If you want to provide a packaged release to your end-users and also let them configure parts of your application at runtime, perhaps you could use something like the new
runtime.exs to read from a file (I haven’t tried that btw).