I agree, all services could potentially inject useful env variables.
Also, I agree most will only have one (mine do). That said, all services do already have a 4-character UID, which could be perfect for this purpose:
MYSQL_H8DE_PORT=3307
MYSQL_8FBR_PORT=50007
I have a question for you though — how would you actually use these environment variables?
In Laravel, for example, you could add this to your .env
file:
DB_PORT=${MYSQL_8FBR_PORT}
...however that will only take effect when you empty the config cache (php artisan config:cache
). Since Indigo may assign a new port (when the port is configured to "auto") any time the stack is started, that would break the site until the config was next cleared.
Thoughts?