Refactoring assignment of environment variables for dependencies that expose more than one port