# Set common environment variable

**URL:** <https://forums.suse.com/t/set-common-environment-variable/3954>\
**Category:** Rancher 1.x\
**Created:** [September 9, 2016, 11:59am UTC](https://forums.suse.com/t/set-common-environment-variable/3954 "2016-09-09T11:59:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmls](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jmls/32/1419_2.png) [@jmls](https://forums.suse.com/u/jmls)\
**Post date:** [September 9, 2016, 11:59am UTC](https://forums.suse.com/t/set-common-environment-variable/3954/1 "2016-09-09T11:59:51Z")

</div>

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
