I am writing a simple command line application and added a package which has a dependency on Mix. When I try to run my application I get a failing message of
Could not start application mix: could not find application file: mix.app
Looking at the package code, the HTTP client is changed based on whether being run in test with a Mix ENV lookup.
Is this a standard practice and I should add Mix to my list of dependencies? Or should I refactor?
Suggestions on a different mechanism are appreciated.
No it was not HTTPClient itself. The package code was using an alternate module based on running in test environment. I was unsure if this was a standard practice, and, assuming not, a different approach to take.
At a minimum I can remove the code and force it to always use the prod module.
It should be a fairly common practice to configure the application you want to use at compile time. You can read a bit about this in a blog post by José.
Thanks for the blog article. I actually found it earlier as well. The article suggests using Application.get_env, which I believes requires the dependency of mix.
As this is for a command line application, I am not too worried about the introduction of mix. But, I am still unclear as to whether this is the proper way for a larger scale application.