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

This commit is contained in:
egarette@silique.fr 2025-11-22 14:14:13 +01:00
parent c71fc3ccab
commit d687d17d12
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_101] A choice variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_101/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_101~1..v1.1_101))
- [[tutorial v1.1_102] A web_address variable ](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_102~1..v1.1_102))
# [tutorial v1.1_102)] A web_address variable
# [tutorial v1.1_103)] A variable with custom validation
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_102~1..v1.1_102)
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_103~1..v1.1_103)
[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_102
git switch --detach v1.1_103
```
## Structure
@ -39,16 +39,16 @@ git switch --detach v1.1_102
<p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./firefox/10-manual.yml">10-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./firefox/20-manual.yml">20-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./firefox/30-auto.yml">30-auto.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./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_102/./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_102/./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_102/./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_103/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./firefox/">firefox</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./firefox/10-manual.yml">10-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./firefox/20-manual.yml">20-manual.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./firefox/30-auto.yml">30-auto.yml</a><br/>
    ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./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_103/./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_103/./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_103/./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' %}
@ -153,18 +159,18 @@ or "firefox.manual.socks_proxy.version" is "v4"
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **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
@ -233,17 +239,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
@ -276,4 +277,4 @@ Variables:
</pre>
- [[tutorial v1.1_103] A variable with custom validation](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_103~1..v1.1_103))
- [[tutorial v1.1_110] Namespace](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_110/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_110~1..v1.1_110))

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_102/./">.</a><br>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./firefox/">firefox</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_102/./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_102/./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_102/./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_102/./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_102/./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_102/./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_102/./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_102/./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_103/./">.</a><br>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./firefox/">firefox</a><br>
&nbsp;&nbsp;&nbsp; ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_103/./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_103/./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_103/./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_103/./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_103/./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_103/./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_103/./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_103/./firefox/60-dns_over_https.yml">60-dns_over_https.yml</a><br>
<br><br><p>
2 directories, 8 files