Where should you put application properties in an erbar application?

Newbie question: I wrote the first erlang armature based application. I want to configure some basic functions, such as a server node, etc. Where is the best place to place them and how to upload them to the application?

+4
source share
1 answer

The next steps are to release and create a node in it. A node runs your application in a standalone Erlang virtual machine. A good starting point for creating an outlet using rebar:

Managing Erlang Applications with Armature

Once you have created the release. Configuration properties for all applications in your node can be added to

{your-app}/{release}/files/sys.config 

You can read individual properties as follows:

 Val = application:get_env(APP, KEY) 

Alternatively, all properties for your application can be read as

 Config = application:get_all_env(APP) 

In sys.config properties can be added as a proplist .

Example:

  {myapp, [ {port, 1234}, {pool_size, 5} ] } 
+5
source

Source: https://habr.com/ru/post/1395943/


All Articles