Set common environment variable

When using the api to launch a new stack in an environment, is there a way of adding an environment variable to the main service ? I want to add a variable to any stack that is launched, but don’t want to have to modify the template of each application in the catalog

I had thought of adding a key to the docker-compose.yml dynamically, but ran into the issue of not knowing what the name of the “main” service is in the compose file