File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,33 @@ defmodule Mix.Project do
91
91
to be part of the configuration returned by `project/0`. This setting also
92
92
makes sure Elixir is not added as a dependency to the generated `.app` file or
93
93
to the escript generated with `mix escript.build`, and so on.
94
+
95
+ ## Invoking this module
96
+
97
+ This module contains many functions that return project information and
98
+ metadata. However, since Mix is not included nor configured during releases,
99
+ we recommend using the functions in this module only inside Mix tasks.
100
+ If you need to configure your own app, consider using the application
101
+ environment instead. For example, don't do this:
102
+
103
+ def some_config do
104
+ Mix.Project.config()[:some_config]
105
+ end
106
+
107
+ Nor this:
108
+
109
+ @some_config Mix.Project.config()[:some_config]
110
+
111
+ Instead, do this:
112
+
113
+ def some_config do
114
+ Application.get_env(:my_app, :some_config)
115
+ end
116
+
117
+ Or this:
118
+
119
+ @some_config Application.compile_env(:my_app, :some_config)
120
+
94
121
"""
95
122
96
123
@ doc false
You can’t perform that action at this time.
0 commit comments