Implementations must act as if they used the following algorithm to export POSIX-compliant dotenv files.
The inputs to the exporting stage are:
- the associative array returned by the evaluation stage
- an optional override flag
The exporting stage has no output.
The override flag is a boolean flag that defaults to false
Please refer to:
- The POSIX specification.
- The article on wikipedia.
- For each (
key
,value
) pair in the associative array returned by the evaluation stage:- if any of the following conditions holds true:
- the override flag is
true
, - no environment variable named
key
is defined in the environment of the current process,
- the override flag is
- then set the value of the environment variable named
key
tovalue
- if any of the following conditions holds true: