Commit 2afad43
committed
Add error handling to env config handling
This adds several changes to how environment variables are handled to
more closely align with how configs are handled, and to fix an issue
with replacing entire tables. The changes are:
- Top-level tables like `MDBOOK_BOOK` now *replace* the contents of the
`book` table instead of merging it. This adds consistency with how all
the other environment objects work.
- Fixed allowing top-level replacement of `MDBOOK_BOOK` and
`MDBOOK_OUTPUT`. This was inadvertently recently broken.
- Added ability to replace top-level `MDBOOK_RUST`. I don't recall why
that wasn't included.
- Reject invalid keys like `MDBOOK_FOO`.
- Reject unknown keys, like `MDBOOK_BOOK='{"xyz": 123}'`
- Reject invalid types, like `MDBOOK_BOOK='{"title": 123}'`1 parent 5445458 commit 2afad43
File tree
5 files changed
+68
-62
lines changed- crates
- mdbook-core/src
- mdbook-driver/src
- guide/src/format/configuration
- tests/testsuite
5 files changed
+68
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
| |||
147 | 146 | | |
148 | 147 | | |
149 | 148 | | |
150 | | - | |
| 149 | + | |
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
| |||
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 164 | + | |
177 | 165 | | |
| 166 | + | |
178 | 167 | | |
179 | 168 | | |
180 | 169 | | |
| |||
266 | 255 | | |
267 | 256 | | |
268 | 257 | | |
269 | | - | |
270 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
271 | 265 | | |
272 | 266 | | |
273 | 267 | | |
274 | 268 | | |
275 | 269 | | |
276 | 270 | | |
277 | | - | |
278 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
279 | 283 | | |
280 | | - | |
| 284 | + | |
281 | 285 | | |
282 | | - | |
| 286 | + | |
283 | 287 | | |
284 | | - | |
| 288 | + | |
285 | 289 | | |
286 | | - | |
| 290 | + | |
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
| |||
703 | 707 | | |
704 | 708 | | |
705 | 709 | | |
706 | | - | |
| 710 | + | |
707 | 711 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
718 | 717 | | |
719 | 718 | | |
720 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 219 | + | |
223 | 220 | | |
224 | 221 | | |
225 | 222 | | |
| |||
231 | 228 | | |
232 | 229 | | |
233 | 230 | | |
| 231 | + | |
234 | 232 | | |
235 | 233 | | |
236 | | - | |
237 | | - | |
238 | | - | |
| 234 | + | |
| 235 | + | |
239 | 236 | | |
240 | 237 | | |
241 | 238 | | |
242 | 239 | | |
243 | 240 | | |
| 241 | + | |
244 | 242 | | |
245 | 243 | | |
246 | | - | |
247 | | - | |
248 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
249 | 247 | | |
250 | 248 | | |
251 | 249 | | |
252 | | - | |
| 250 | + | |
253 | 251 | | |
254 | 252 | | |
255 | 253 | | |
| |||
276 | 274 | | |
277 | 275 | | |
278 | 276 | | |
279 | | - | |
| 277 | + | |
| 278 | + | |
280 | 279 | | |
281 | 280 | | |
282 | 281 | | |
| |||
311 | 310 | | |
312 | 311 | | |
313 | 312 | | |
| 313 | + | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | 332 | | |
334 | 333 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
339 | 338 | | |
340 | 339 | | |
341 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
342 | 343 | | |
0 commit comments