Skip to content

Commit 8b1be45

Browse files
committed
adds mermaid charts to illustate env inheritance
1 parent e697044 commit 8b1be45

3 files changed

Lines changed: 54 additions & 1 deletion

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ Environment variable composition and activation layer for tools and processes.
1515

1616
envstack focuses on **configuration and activation**, not dependency resolution.
1717

18+
```mermaid
19+
flowchart TD
20+
default[default.env] --> prod[prod.env]
21+
prod --> dev[dev.env]
22+
prod --> test[test.env]
23+
```
24+
25+
Later layers override earlier ones. Use envstack -t VAR to trace where a value
26+
comes from.
27+
1828
For the core concepts, see `docs/index.md`.
1929

2030
## Installation

docs/design.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ Stacks may be composed by:
4848

4949
Variables flow through the stack according to precedence rules.
5050

51+
```mermaid
52+
flowchart TD
53+
base[base.env]
54+
prod[prod.env]
55+
project[project.env]
56+
task[task.env]
57+
keys[keys.env]
58+
59+
base --> prod --> project --> task
60+
keys -. include .-> prod
61+
keys -. include .-> project
62+
```
63+
5164
## Precedence and overrides
5265

5366
Precedence in envstack is **explicit and ordered**.
@@ -81,6 +94,13 @@ variable.
8194
`ENVPATH` is an ordered, colon-separated list of directories that envstack
8295
searches when resolving environment names.
8396

97+
envstack searches `ENVPATH` left-to-right; earlier entries win when the same env
98+
name exists in multiple locations:
99+
100+
```bash
101+
ENVPATH=/mnt/tools/dev/env:/mnt/tools/prod/env
102+
```
103+
84104
Resolution follows these rules:
85105
- Directories are searched left to right
86106
- Later entries override earlier ones

docs/examples.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ document every feature.
1212

1313
This is the simplest envstack use case and a direct evolution of a `.env` file.
1414

15+
```mermaid
16+
flowchart LR
17+
base[default.env] --> local[local.env]
18+
```
19+
1520
Typical characteristics:
1621
- One base environment
1722
- A small number of variables
@@ -32,6 +37,13 @@ Common use cases:
3237
A common pattern is to define a shared base environment and layer environment
3338
tiers on top (e.g. dev, prod, CI).
3439

40+
```mermaid
41+
flowchart TD
42+
base[default.env] --> prod[prod.env]
43+
prod --> dev[dev.env]
44+
prod --> test[test.env]
45+
```
46+
3547
Typical characteristics:
3648
- A base environment defines common paths and defaults
3749
- Environment tiers override a small number of variables
@@ -52,8 +64,14 @@ Common use cases:
5264
Projects often share infrastructure but differ in paths, naming, or behavior.
5365
envstack models this naturally through inheritance and layering.
5466

67+
```mermaid
68+
flowchart LR
69+
base[default.env] --> prod[prod.env]
70+
prod -. include .-> project[project.env]
71+
```
72+
5573
Typical characteristics:
56-
- Facility or global base environment
74+
- Facility or global default environment
5775
- Project environment that includes the base
5876
- Minimal duplication of shared configuration
5977

@@ -72,6 +90,11 @@ Common use cases:
7290
This pattern combines multiple layers into a single stack, with each layer
7391
responsible for a specific concern.
7492

93+
```mermaid
94+
flowchart LR
95+
default --> env --> project --> task
96+
```
97+
7598
Typical characteristics:
7699
- Clear separation of responsibility per layer
77100
- Downstream layers override upstream values

0 commit comments

Comments
 (0)