toml-combine 1.0.2__py3-none-any.whl → 1.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {toml_combine-1.0.2.dist-info → toml_combine-1.0.3.dist-info}/METADATA +90 -30
- {toml_combine-1.0.2.dist-info → toml_combine-1.0.3.dist-info}/RECORD +5 -5
- {toml_combine-1.0.2.dist-info → toml_combine-1.0.3.dist-info}/WHEEL +0 -0
- {toml_combine-1.0.2.dist-info → toml_combine-1.0.3.dist-info}/entry_points.txt +0 -0
- {toml_combine-1.0.2.dist-info → toml_combine-1.0.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: toml-combine
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.3
|
4
4
|
Summary: A tool for combining complex configurations in TOML format.
|
5
5
|
Author-email: Joachim Jablon <ewjoachim@gmail.com>
|
6
6
|
License-Expression: MIT
|
@@ -47,7 +47,10 @@ name = "my-service"
|
|
47
47
|
registry = "gcr.io/my-project/"
|
48
48
|
container.image_name = "my-image"
|
49
49
|
container.port = 8080
|
50
|
-
|
50
|
+
|
51
|
+
[[override]]
|
52
|
+
when.environment = "production"
|
53
|
+
service_account = "my-production-service-account"
|
51
54
|
|
52
55
|
[[override]]
|
53
56
|
when.environment = "staging"
|
@@ -73,50 +76,107 @@ Each override defines a set of condition where it applies (`when.<dimension> =
|
|
73
76
|
|
74
77
|
```toml
|
75
78
|
[[override]]
|
76
|
-
#
|
79
|
+
# Keys starting with `when.` are "conditions"
|
77
80
|
when.environment = "staging"
|
78
81
|
when.region = "us"
|
79
82
|
|
80
|
-
#
|
83
|
+
# Other keys in an override are "overridden keys" / "overridden values"
|
81
84
|
service_account = "my-us-staging-service-account"
|
82
85
|
```
|
83
86
|
|
84
|
-
If
|
85
|
-
checked for _compatibility_ with one another, and an error
|
87
|
+
If you run `toml-combine` with a given mapping that selects multiple overrides, they
|
88
|
+
will be checked for _compatibility_ with one another, and an error will be raised if
|
89
|
+
they're _not compatible_.
|
86
90
|
|
87
91
|
Compatibility rules:
|
88
92
|
|
89
|
-
- If the two overrides don't share any
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
+
- If the two overrides don't share any _overridden key_, then they're always compatible.
|
94
|
+
|
95
|
+
<details>
|
96
|
+
<summary>Example (click to expand)</summary>
|
97
|
+
|
98
|
+
```toml
|
99
|
+
[dimensions]
|
100
|
+
environment = ["staging"]
|
101
|
+
region = ["eu"]
|
102
|
+
|
103
|
+
[[override]]
|
104
|
+
when.environment = "staging"
|
105
|
+
service_account = "my-staging-service-account"
|
106
|
+
|
107
|
+
[[override]]
|
108
|
+
when.region = "eu"
|
109
|
+
env.CURRENCY = "EUR"
|
110
|
+
```
|
111
|
+
|
112
|
+
</details>
|
113
|
+
|
114
|
+
- If an override defines a set of conditions (say `env=prod`) and the other one defines
|
115
|
+
strictly more conditions (say `env=prod, region=eu`, in other words, it defines all
|
116
|
+
the conditions of the first override and then some more), then they're compatible.
|
117
|
+
Also, in that case, **the override with more conditions will have precedence**.
|
118
|
+
|
119
|
+
<details>
|
120
|
+
<summary>Example</summary>
|
121
|
+
|
122
|
+
```toml
|
123
|
+
[dimensions]
|
124
|
+
environment = ["staging"]
|
125
|
+
region = ["eu"]
|
126
|
+
|
127
|
+
[[override]]
|
128
|
+
when.environment = "staging"
|
129
|
+
service_account = "my-staging-service-account"
|
130
|
+
|
131
|
+
[[override]]
|
132
|
+
when.environment = "staging"
|
133
|
+
when.region = "eu"
|
134
|
+
service_account = "my-staging-eu-service-account"
|
135
|
+
```
|
136
|
+
|
137
|
+
</details>
|
138
|
+
|
93
139
|
- If they both define a dimension that the other one doesn't, they're incompatible.
|
94
140
|
|
95
|
-
|
96
|
-
|
141
|
+
<details>
|
142
|
+
<summary>Example (click to expand)</summary>
|
97
143
|
|
98
|
-
|
99
|
-
|
100
|
-
environment = ["staging"]
|
101
|
-
region = ["eu"]
|
144
|
+
Incompatible overrides: neither is a subset of the other one and they both
|
145
|
+
define a value for `service_account`:
|
102
146
|
|
103
|
-
|
104
|
-
|
105
|
-
|
147
|
+
```toml
|
148
|
+
[dimensions]
|
149
|
+
environment = ["staging"]
|
150
|
+
region = ["eu"]
|
106
151
|
|
107
|
-
[
|
108
|
-
|
109
|
-
foo = "baz"
|
110
|
-
```
|
152
|
+
[default]
|
153
|
+
service_account = "my-service-account"
|
111
154
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
155
|
+
[[override]]
|
156
|
+
when.environment = "staging"
|
157
|
+
service_account = "my-staging-service-account"
|
158
|
+
|
159
|
+
[[override]]
|
160
|
+
when.region = "eu"
|
161
|
+
service_account = "my-eu-service-account"
|
162
|
+
```
|
163
|
+
|
164
|
+
```console
|
165
|
+
$ toml-combine config.toml --environment=staging --region=eu
|
166
|
+
Error: Incompatible overrides `{'region': ['eu']}` and `{'environment': ['staging']}`:
|
167
|
+
When they're both applicable, overrides defining a common overridden key (foo) must be
|
168
|
+
a subset of one another
|
169
|
+
```
|
170
|
+
|
171
|
+
> [!NOTE]
|
172
|
+
> It's ok to have incompatible overrides in your config as long as you don't
|
173
|
+
> run `toml-combine` with a mapping that would select both of them. In the example
|
174
|
+
> above, if you run `toml-combine --environment=staging --region=eu`, the error
|
175
|
+
> will be triggered, but you can run `toml-combine --environment=staging`.
|
176
|
+
|
177
|
+
</details>
|
118
178
|
|
119
|
-
> [!
|
179
|
+
> [!NOTE]
|
120
180
|
> Instead of defining a single value for the override dimensions, you can define a list.
|
121
181
|
> This is a shortcut to duplicating the override with each individual value:
|
122
182
|
>
|
@@ -5,8 +5,8 @@ toml_combine/combiner.py,sha256=fjsZ4WAKl7uO8BE8lYirJgo_1uj1t2o24rJA_FT1NFM,6147
|
|
5
5
|
toml_combine/exceptions.py,sha256=KrZpSdaI_ssYKw9LMsc3PAqNXEP-q6sT9scpgpXOo8o,1094
|
6
6
|
toml_combine/lib.py,sha256=jh6OG57JefpGa-WE-mLSIK6KjyJ0-1yGBynr_kiVTww,1634
|
7
7
|
toml_combine/toml.py,sha256=iBV8xj0qWcvGp2AZaML8FCT3i2X9DL7iA6jd-wcP5Bc,814
|
8
|
-
toml_combine-1.0.
|
9
|
-
toml_combine-1.0.
|
10
|
-
toml_combine-1.0.
|
11
|
-
toml_combine-1.0.
|
12
|
-
toml_combine-1.0.
|
8
|
+
toml_combine-1.0.3.dist-info/METADATA,sha256=mP4H-UhEjmZedJSN55C6OOKvqOf2xgS1U4xYi2afKas,10653
|
9
|
+
toml_combine-1.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
toml_combine-1.0.3.dist-info/entry_points.txt,sha256=dXUQNom54uZt_7ylEG81iNYMamYpaFo9-ItcZJU6Uzc,58
|
11
|
+
toml_combine-1.0.3.dist-info/licenses/LICENSE,sha256=tA7wpipzIPGl7xL5xzMMg0RhhXz9CKOa-ZnlYzgiTKg,1059
|
12
|
+
toml_combine-1.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|