@@ -54,12 +54,12 @@ defmodule Application do
54
54
You can also change the application environment dynamically by using functions
55
55
such as `put_env/3` and `delete_env/2`.
56
56
57
- > #### Environment in libraries {: .tip }
57
+ > #### Application environment in libraries {: .info }
58
58
>
59
- > The config files `config/config.exs` and `config/runtime.exs`
60
- > are rarely used by libraries. Libraries typically define their environment
61
- > in the `application/0` function of their `mix.exs`. Configuration files
62
- > are rather used by applications to configure their libraries .
59
+ > If you are writing a library to be used by other developers,
60
+ > it is generally recommended to avoid the application environment, as the
61
+ > application environment is effectively a global storage. For more information,
62
+ > read our [library guidelines](library-guidelines.md) .
63
63
64
64
> #### Reading the environment of other applications {: .warning}
65
65
>
@@ -673,13 +673,6 @@ defmodule Application do
673
673
> You must use this function to read only your own application
674
674
> environment. Do not read the environment of other applications.
675
675
676
- > #### Application environment in libraries {: .info}
677
- >
678
- > If you are writing a library to be used by other developers,
679
- > it is generally recommended to avoid the application environment, as the
680
- > application environment is effectively a global storage. For more information,
681
- > read our [library guidelines](library-guidelines.md).
682
-
683
676
## Examples
684
677
685
678
`get_env/3` is commonly used to read the configuration of your OTP applications.
@@ -796,6 +789,12 @@ defmodule Application do
796
789
@ doc """
797
790
Puts the `value` in `key` for the given `app`.
798
791
792
+ > #### Compile environment {: .warning}
793
+ >
794
+ > Do not use this function to change environment variables read
795
+ > via `Application.compile_env/2`. The compile environment must
796
+ > be exclusively set before compilation, in your config files.
797
+
799
798
## Options
800
799
801
800
* `:timeout` - the timeout for the change (defaults to `5_000` milliseconds)
0 commit comments