Q:

Where do values from a config or application:set_env go? How do I get them?

I am working with the Erlang MQTT broker which uses cuttlefish to generate .config files for the application. The values in the config files end up being used in the application, so for example at one point the Opts variable will contain values from the config file like {ssl_opts, {more, values, here}}...}
Where are these values stored? How could I access them from inside a function? I am generally confused about the whole process, and help or links would greatly help my understanding!

A:

The module aplication from application kernel is responsible for it. The values are accessible using application:get_env/1,2,3 functions and application:get_all_env/0,1
and application:get_key/1,2 and application:get_all_key/0,1 as well. It is stored in named public ets table ac_tab ([set, public, named_table, {read_concurrency,true}]). To be precise, internal module application_controller is responsible for it.
The values from various configs (.app and .config files) are merged (mainly env key) and loaded into the ac_tab table in application:load/1,2 which is prerequisite for appliaction:start/1,2. Read more details in 7 Applications chapter of OTP Design Principles User's Guide.
Your question is partialy answered also in How to use application:get_env() in Erlang/OTP?.

