[tutorial v1.1_093)] A variable with custom validation (config and doc)

This commit is contained in:
egarette@silique.fr 2025-11-10 08:21:47 +01:00
parent bbc778e39b
commit 2174a3379a
3 changed files with 47 additions and 51 deletions

View file

@ -1,11 +1,11 @@
- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md)
- [[tutorial v1.1_091] A choice variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_091/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_091~1..v1.1_091))
- [[tutorial v1.1_092] A web_address variable ](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_092~1..v1.1_092))
# [tutorial v1.1_092)] A web_address variable
# [tutorial v1.1_093)] A variable with custom validation
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_092~1..v1.1_092)
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_093~1..v1.1_093)
[Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculation.html#a-web_address-variable)
[Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/calculation.html#a-variable-with-custom-validation)
## Screenshot
@ -31,7 +31,7 @@ pip install rougail-cli rougail-output-exporter rougail-output-doc rougail-user-
Then switch to the tutorial page:
```shell
git switch --detach v1.1_092
git switch --detach v1.1_093
```
## Structure
@ -39,16 +39,16 @@ git switch --detach v1.1_092
<p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/10-manual.yml">10-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/20-manual.yml">20-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/30-auto.yml">30-auto.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br/>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/10-manual.yml">10-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/20-manual.yml">20-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/30-auto.yml">30-auto.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br/>
<br/><br/></p>
Contents of the firefox/60-dns_over_https.yml file
@ -76,6 +76,12 @@ dns_over_https: # DNS over HTTPS
custom_dns_url:
description: Custom DNS URL
type: web_address
validators:
- jinja: |-
{% if _.custom_dns_url.startswith('http://') %}
only https is allowed
{% endif %}
description: must starts with 'https://' only
disabled:
jinja: |-
{% if _.provider is propertyerror or _.provider != 'Custom' %}
@ -152,18 +158,18 @@ rougail -m firefox/ --modes_level basic standard advanced -o doc
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **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**: when the variable "dns_over_https.enable_dns_over_https" has the value "false" |
| **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**: the domain name in web address can be only a hostname<br/>**Disabled**: if "_.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/>**Validators**: <br/>- the domain name in web address can be only a hostname<br/>- must starts with 'https://' only<br/>**Disabled**: if "_.provider" is not "Custom" |
### Let's generate the changelog
```shell
rougail -m firefox/ --modes_level basic standard advanced -o doc --doc.contents changelog
```
#### New variable
#### Modified variable
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **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**: the domain name in web address can be only a hostname<br/>**Disabled**: if "_.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/>**Validators**: <br/>- the domain name in web address can be only a hostname<br/>- <ins>must starts with 'https://' only</ins><br/>**Disabled**: if "_.provider" is not "Custom" |
## User datas
@ -232,17 +238,12 @@ dns_over_https:
```shell
rougail -m firefox/ --modes_level basic standard advanced -u yaml -yf config/03/config.yml
```
<pre>╭────────────── Caption ───────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
│ Modified value │
│ (<span style="color: #00aa00">⏳ Original default value</span>) │
╰──────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 Configure Proxy Access to the Internet: <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 ◀ loaded from the YAML file "config/03/config.yml" (⏳ <span style="color: #00aa00">false</span>)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 Use Provider: Custom ◀ loaded from the YAML file "config/03/config.yml" (⏳ <span style="color: #00aa00">Cloudflare</span>)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 Custom DNS URL: http://dns.net ◀ loaded from the YAML file "config/03/config.yml"
<pre><span style="font-weight: bold; color: #ffff00">🔔 WARNINGS</span>
<span style="color: #ffff00">┗━━ </span>the value "http://dns.net" is an invalid URL for "dns_over_https.custom_dns_url" (Custom DNS URL), only https is allowed, it will be ignored when loading from the YAML file "config/03/config.yml"
<span style="font-weight: bold; color: #ff0000">🛑 ERRORS</span>
<span style="color: #ff0000">┗━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>DNS over HTTPS
<span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>Custom DNS URL
</pre>
### Example 4
@ -275,4 +276,4 @@ Variables:
</pre>
- [[tutorial v1.1_093] A variable with custom validation](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_093~1..v1.1_093))
- [[tutorial v1.1_100] Namespace](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_100/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_100~1..v1.1_100))

View file

@ -1,12 +1,7 @@
<pre>╭────────────── Caption ───────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
│ Modified value │
│ (<span style="color: #00aa00">⏳ Original default value</span>) │
╰──────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┣━━ </span>📓 Configure Proxy Access to the Internet: <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 ◀ loaded from the YAML file "config/03/config.yml" (⏳ <span style="color: #00aa00">false</span>)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┣━━ </span>📓 Use Provider: Custom ◀ loaded from the YAML file "config/03/config.yml" (⏳ <span style="color: #00aa00">Cloudflare</span>)
<span style="color: #5c5cff"> </span><span style="color: #5c5cff">┗━━ </span>📓 Custom DNS URL: http://dns.net ◀ loaded from the YAML file "config/03/config.yml"
<pre><span style="font-weight: bold; color: #ffff00">🔔 WARNINGS</span>
<span style="color: #ffff00">┗━━ </span>the value "http://dns.net" is an invalid URL for "dns_over_https.custom_dns_url" (Custom DNS URL), only https is allowed, it will be ignored when loading from the YAML file "config/03/config.yml"
<span style="font-weight: bold; color: #ff0000">🛑 ERRORS</span>
<span style="color: #ff0000">┗━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>DNS over HTTPS
<span style="color: #ff0000"> </span><span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span>Custom DNS URL
</pre>

View file

@ -25,16 +25,16 @@
</head>
<body>
<h1>Directory Tree</h1><p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./">.</a><br>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/">firefox</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/00-proxy.yml">00-proxy.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/10-manual.yml">10-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/20-manual.yml">20-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/30-auto.yml">30-auto.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br>
&nbsp;&nbsp;&nbsp; └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_092/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./">.</a><br>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/">firefox</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/00-proxy.yml">00-proxy.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/10-manual.yml">10-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/20-manual.yml">20-manual.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/30-auto.yml">30-auto.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/40-no_proxy.yml">40-no_proxy.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/50-prompt_authentication.yml">50-prompt_authentication.yml</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/55-proxy_dns_socks5.yml">55-proxy_dns_socks5.yml</a><br>
&nbsp;&nbsp;&nbsp; └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_093/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br>
<br><br><p>
2 directories, 8 files