diff options
author | Alexander Clouter <[email protected]> | 2018-04-13 14:41:43 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-05-14 14:46:51 +0200 |
commit | acad32896ebd43405adb6804072a9fbc57bc9f4b (patch) | |
tree | f25d3b18d2683f4ffa131900ecca3c68d1fda9e8 | |
parent | 0e51f89ea7705a85e7fcce427a3f786f7f3d537f (diff) | |
download | erlang.mk-acad32896ebd43405adb6804072a9fbc57bc9f4b.tar.gz erlang.mk-acad32896ebd43405adb6804072a9fbc57bc9f4b.tar.bz2 erlang.mk-acad32896ebd43405adb6804072a9fbc57bc9f4b.zip |
Document PROJECT_ENV usage with/without file
LH: I have added the example without a separate file and
tweaked the wording a bit.
-rw-r--r-- | doc/src/guide/app.asciidoc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/src/guide/app.asciidoc b/doc/src/guide/app.asciidoc index 94f8eb1..9d5e948 100644 --- a/doc/src/guide/app.asciidoc +++ b/doc/src/guide/app.asciidoc @@ -164,6 +164,42 @@ Any space before and after the value is dropped. xref:deps[Dependencies] are covered in details in the next chapter. +==== Application environment + +The `PROJECT_ENV` variable is used to set the application +environment: + +[source,make] +---- +define PROJECT_ENV +[ + {chips, [currysauce,{mushypeas,false}]}, + {pizza, [{size,large},{toppings,[anchovies]}]} +] +endef +---- + +If you have a large set of environment variables, you may find it +easier to use a separate file. Do this by including the following +in your Makefile: + +[source,make] +---- +PROJECT_ENV_FILE = src/env.src +PROJECT_ENV = $(subst \n,$(newline),$(shell cat $(PROJECT_ENV_FILE) | sed -e 's/$$/\\n/;')) +ebin/$(PROJECT).app:: $(PROJECT_ENV_FILE) +---- + +The file has the same contents as the `PROJECT_ENV` variable: + +[source,erlang] +---- +[ + {chips, [currysauce,{mushypeas,false}]}, + {pizza, [{size,large},{toppings,[anchovies]}]} +] +---- + ==== Legacy method The 'src/$(PROJECT).app.src' file is a legacy method of |