Hi,
The "env-map" array in the composer.json file expect to have a mapping between an environement variable (the key) and a key definition in the YAML parameters.yml file (the value).
ParameterHandler tries to parse the "env-map" with the YAML component to get a PHP array as a mapping.
PHP arrays can't have same key twice, the second affectation replace the previous value associated with the key used the first time.
As a consequence, you can't use the same env var several times for different mapping in the env-map array.
Ex: In my parameters.yml.dist file, I have the following database user declaration : 'database_user' and 'dev_database_user'.
Suppose we want to reuse the same env var to fill this two fields. We wanna to have a mapping array like this :
{
"extra": {
"incenteev-parameters": {
"env-map": {
"MY_DATABASE_USER": "database_user",
"MY_DATABASE_USER": "dev_database_user"
}
}
}
}
But the ParameterHandler script will only autofill the dev_database_user field, and will prompt the user for the desired value for database_user.
Whould it be make more sense to invert the key and values to allow multiple utilisation of an environement variable?
Ex:
{
"extra": {
"incenteev-parameters": {
"env-map": {
"database_user" : "MY_DATABASE_USER",
"dev_database_user" : "MY_DATABASE_USER"
}
}
}
}
I know that this change will cause every project to change their composer.json file. But I think that's a good improvement.