-
Notifications
You must be signed in to change notification settings - Fork 130
Cuttlefish for Erlang Developers
As an Erlang developer, you're probably used to application:set_env
and app.config
files. The good news for you is that you can keep on coding that way! The... additional news is that people who are using your application may not understand that syntax so easily. So how can you help? I'm glad you asked!
You have a new job. You get to choose which knobs you expose to customers! You can choose to name these things anything you want, so where you previously might have been confined to including a dependency's application name, you are now not.
You can define datatypes for these settings, and you can explain to cuttlefish how a simple name-value pair becomes part of a complex hierarchy of Erlang terms!
As the Erlang developer, you are the person responsible for being the ambassador of your setting to the world. Here's how it looks in ASCII art:
┌--------------------┐ ┌--------------------┐
| <app>.conf | | app.config |
|--------------------| {mapping, {translation, | -------------------|
| my.setting = value | ---> "my.setting", ---> "<dependency>.setting", ---> | [{<dependency, [ |
| ... | "<dependency>.setting", fun(Conf) -> | {setting, value}|
| | []}. %% erlang fun | ]}, ... ]. |
└--------------------┘ end}. └--------------------┘