Friday, January 16, 2015

default value for application environment variable

Current Erlang release contains a function application:get_env/3. Until it was included into OTP, many projects had developed similar functionality of specifying a default value for application environment variable.
This function in some cases makes system more complicated in terms of understanding and configuration. Basically it transfers value of variable from node config and .app file to the code. As a result if default value is used, user of node/application has no chance to notice such variable besides analysing of documentation, which is not always relevant or event exists, or source code.
In general it's a good practice to put some reasonable default value for each variable into the .app file of application.

No comments:

Post a Comment