[tutorial 083] A variable with custom validation (config and doc)
This commit is contained in:
parent
d1b4bee1f2
commit
01aeeae707
2 changed files with 21 additions and 29 deletions
33
README.md
33
README.md
|
@ -1,9 +1,9 @@
|
|||
- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md)
|
||||
- [[tutorial 081] A choice variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_081/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_081~1..v1.1_081))
|
||||
- [[tutorial 082] A web_address variable ](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_082/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_082~1..v1.1_082))
|
||||
|
||||
# [tutorial 082] A web_address variable
|
||||
# [tutorial 083] A variable with custom validation
|
||||
|
||||
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_082~1..v1.1_082)
|
||||
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_083~1..v1.1_083)
|
||||
|
||||
|
||||
## Screenshot
|
||||
|
@ -203,6 +203,12 @@ dns_over_https: # DNS over HTTPS
|
|||
provider is not custom
|
||||
{% endif %}
|
||||
description: if "dns_over_https.provider" is not "Custom"
|
||||
validators:
|
||||
- jinja: |
|
||||
{% if dns_over_https.custom_dns_url.startswith('http://') %}
|
||||
only https is allowed
|
||||
{% endif %}
|
||||
description: must starts with 'https://' only
|
||||
|
||||
```
|
||||
### Generated documentation
|
||||
|
@ -266,7 +272,7 @@ This family builds families dynamically.
|
|||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **dns_over_https.enable_dns_over_https**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | Enable DNS over HTTPS.<br/>**Default**: False |
|
||||
| **dns_over_https.provider**<br/>[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` _`disabled`_ | Use Provider.<br/>**Choices**: <br/>- Cloudflare ← (default)<br/>- NextDNS<br/>- Custom<br/>**Disabled**: dns_over_https.enable_dns_over_https. |
|
||||
| **dns_over_https.custom_dns_url**<br/>[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Custom DNS URL.<br/>**Disabled**: if "dns_over_https.provider" is not "Custom". |
|
||||
| **dns_over_https.custom_dns_url**<br/>[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` _`disabled`_ | Custom DNS URL.<br/>**Validator**: must starts with 'https://' only.<br/>**Disabled**: if "dns_over_https.provider" is not "Custom". |
|
||||
|
||||
|
||||
## User data
|
||||
|
@ -342,18 +348,11 @@ dns_over_https:
|
|||
```console
|
||||
foo@bar:~$ rougail -v 1.1 -m firefox/ --modes_level basic standard advanced -u file -ff config/03/config.yaml
|
||||
```
|
||||
<pre>╭────────────────────────── Caption ──────────────────────────╮
|
||||
│ Variable <span style="color: #ffd700">Default value</span> │
|
||||
│ <span style="color: #5c5cff">Undocumented variable</span> Modified value │
|
||||
│ <span style="color: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
|
||||
│ <span style="color: #ffaf00">Unmodifiable variable</span> │
|
||||
╰─────────────────────────────────────────────────────────────╯
|
||||
Variables:
|
||||
<span style="color: #5c5cff">┣━━ </span>📓 proxy_mode: <span style="color: #ffd700">No proxy</span>
|
||||
<span style="color: #5c5cff">┗━━ </span>📂 dns_over_https
|
||||
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 enable_dns_over_https: True
|
||||
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 provider: Custom (<span style="color: #00aa00">Cloudflare</span>)
|
||||
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 custom_dns_url: http://dns.net
|
||||
<pre>🛑 ERRORS
|
||||
<span style="color: #ff0000">┣━━ </span>"http://dns.net" is an invalid URL for "dns_over_https.custom_dns_url (Custom DNS URL)", only https
|
||||
<span style="color: #ff0000">┃ </span>is allowed
|
||||
<span style="color: #ff0000">┣━━ </span>The following variables are mandatory but have no value:
|
||||
<span style="color: #ff0000">┗━━ </span> - dns_over_https.custom_dns_url (Custom DNS URL)
|
||||
</pre>
|
||||
### Example 4
|
||||
|
||||
|
@ -388,4 +387,4 @@ Variables:
|
|||
</pre>
|
||||
|
||||
|
||||
- [[tutorial 083] A variable with custom validation](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_083/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_083~1..v1.1_083))
|
||||
- [[tutorial 090] Variable in same family](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_090/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_090~1..v1.1_090))
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<pre>╭────────────────────────── Caption ──────────────────────────╮
|
||||
│ Variable <span style="color: #ffd700">Default value</span> │
|
||||
│ <span style="color: #5c5cff">Undocumented variable</span> Modified value │
|
||||
│ <span style="color: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
|
||||
│ <span style="color: #ffaf00">Unmodifiable variable</span> │
|
||||
╰─────────────────────────────────────────────────────────────╯
|
||||
Variables:
|
||||
<span style="color: #5c5cff">┣━━ </span>📓 proxy_mode: <span style="color: #ffd700">No proxy</span>
|
||||
<span style="color: #5c5cff">┗━━ </span>📂 dns_over_https
|
||||
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 enable_dns_over_https: True
|
||||
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 provider: Custom (<span style="color: #00aa00">Cloudflare</span>)
|
||||
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 custom_dns_url: http://dns.net
|
||||
<pre>🛑 ERRORS
|
||||
<span style="color: #ff0000">┣━━ </span>"http://dns.net" is an invalid URL for "dns_over_https.custom_dns_url (Custom DNS URL)", only https
|
||||
<span style="color: #ff0000">┃ </span>is allowed
|
||||
<span style="color: #ff0000">┣━━ </span>The following variables are mandatory but have no value:
|
||||
<span style="color: #ff0000">┗━━ </span> - dns_over_https.custom_dns_url (Custom DNS URL)
|
||||
</pre>
|
||||
|
|
Loading…
Reference in a new issue