@@ -680,13 +680,13 @@ defmodule Application do
680680 ## Examples
681681
682682 `get_env/3` is commonly used to read the configuration of your OTP applications.
683- Since Mix configurations are commonly used to configure applications, we will use
684- this as a point of illustration.
683+ Since Mix configurations are commonly used to configure applications (including
684+ your dependencies), we will use this as a point of illustration.
685685
686686 Consider a new application `:my_app`. `:my_app` contains a database engine which
687687 supports a pool of databases. The database engine needs to know the configuration for
688688 each of those databases, and that configuration is supplied by key-value pairs in
689- environment of `:my_app`.
689+ environment of `:my_app`. For example, your `config/runtime.exs` file might have:
690690
691691 config :my_app, Databases.RepoOne,
692692 # A database configuration
@@ -714,6 +714,11 @@ defmodule Application do
714714 config = Application.get_env(:my_app, Databases.RepoOne)
715715 config[:ip]
716716
717+ The sample `config/runtime.exs` above could be used both for `:my_app` to
718+ configure itself but also to allow any application that depends on `:my_app`
719+ to configure how it works. However, one should keep in mind the caveats described
720+ in the `Application` module documentation: the application environment is global
721+ state which should be avoided if possible.
717722 """
718723 @ spec get_env ( app , key , value ) :: value
719724 def get_env ( app , key , default \\ nil ) when is_atom ( app ) do
0 commit comments