Hi all
I just wanted to provide you a quick tutorial related to a second tiny new library I’ve been developing. It’s called Takeoff, and you can find the source here.
A bit of background: I’ve been struggling with coming up with a good way to run Elixir services that are configured dynamically rather than statically, e.g. by using command-line arguments. One of the situations where I needed it was in my tests, when I wanted to spawn several instances of the same service on different ports.
I have in no way any idea if this is the Elixir way of doing things, but at least this library solves my use-case. There are four things you need to do to get it working:
- Add Takeoff as a dependency
- Remove applications that need to be configured dynamically from
mix.exs
- Make sure your
mix.exs
can build an Escript version of your service. - Add a tiny snippet of code describing the mapping between command-line arguments and configuration entries
The details are described here. It currently is just a quick proof-of-concept so don’t hesitate to let me know if something doesn’t work.