Skip to content

Commit 6c5946c

Browse files
authored
extends (#224)
1 parent 561ee53 commit 6c5946c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

apps/docs/content/zerops-yaml/specification.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,49 @@ zerops:
5252

5353
Each service configuration requires `build` and `run` sections. An optional `deploy` section can be added for readiness checks.
5454

55+
## Service Inheritance
56+
57+
### extends <Badge type="optional" />
58+
59+
The `extends` key allows you to inherit configuration from another service defined in the same `zerops.yaml` file. This is useful for creating environment-specific configurations while maintaining a common base.
60+
61+
```yaml
62+
zerops:
63+
- setup: base
64+
build:
65+
buildCommands:
66+
- echo "hello"
67+
deployFiles: ./
68+
run:
69+
start: server run
70+
71+
- setup: prod
72+
extends: base
73+
run:
74+
crontab:
75+
- command: xyz
76+
allContainers: false
77+
timing: "* * * * *"
78+
79+
- setup: dev
80+
extends: base
81+
run:
82+
crontab:
83+
- command: different command
84+
allContainers: false
85+
timing: "* * * * *"
86+
```
87+
88+
When using `extends`:
89+
- The `extends` value must refer to another service's `setup` value in the same file
90+
- The child service inherits all configuration from the base service
91+
- Configuration is merged at the section level (`build`, `run`, `deploy`)
92+
- You can override specific sections by redefining them
93+
94+
:::tip
95+
Create a base service with common configuration and extend it for environment-specific services to keep your `zerops.yaml` file DRY (Don't Repeat Yourself).
96+
:::
97+
5598
## Build Configuration
5699

57100
### base <Badge type="required" />

0 commit comments

Comments
 (0)