Env groups
Create a reusable set of environment variables once and attach it to any number of services.
An env group is a reusable set of environment variables you attach to one or more services. On deploy, a group's variables are injected into every attached service — a service's own variables always take precedence, so you can override a shared default per service.
Create a group#
- 1
Open Env groups
From the sidebar, open Env groups and click “New group”.
- 2
Add variables
Add keys and values one at a time, or import a .env file to fill the group in one step.
- 3
Attach to services
Attach the group to any service that should receive its variables.
Import a .env file#
Importing merges by default — existing keys are kept unless the file redefines them, in which case the file wins. Choose replace to discard everything not present in the file instead.
Via CLI#
gheima env-groups create shared
gheima env-groups import grp_123 .env.production
gheima env-groups attach grp_123 my-app
gheima env-groups detach grp_123 my-appVia API#
curl -X POST https://gheima.ma/api/v1/env-groups \
-H "Authorization: Bearer $GHEIMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"shared"}'Precedence & limits#
- A service's own environment variables always override a value coming from an attached group.
- When a service has several groups attached, they merge in attach order — the most recently attached group wins on a shared key.
- Deleting a group detaches it from every service; the change takes effect on each service's next deploy.
- The maximum number of env groups on your account is set by your plan.
✦ Your fleet shares config and secrets from one place, instead of copy-pasting the same variables into every service.