type definition, end of relecture
This commit is contained in:
parent
9c0ee92892
commit
f2473f85f8
1 changed files with 104 additions and 1 deletions
|
|
@ -388,9 +388,111 @@ Redefine other parameter in custom type
|
||||||
|
|
||||||
In this sections we are going to make explicit :term:`redefinitions <redefine>`.
|
In this sections we are going to make explicit :term:`redefinitions <redefine>`.
|
||||||
|
|
||||||
|
The type definition didn't change, what we're talking about here is modifiying what has been previously defined
|
||||||
|
in the type definition file:
|
||||||
|
|
||||||
FIXME : redéfinition explicites.
|
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_083/types/proxy/00-type.yml
|
||||||
|
:language: yaml
|
||||||
|
:caption: The :file:`types/proxy/00-type.yml` type definition file with the default definitions
|
||||||
|
|
||||||
|
..
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
proxy:
|
||||||
|
|
||||||
|
address:
|
||||||
|
description: Proxy address
|
||||||
|
type: domainname
|
||||||
|
params:
|
||||||
|
allow_ip: true
|
||||||
|
default:
|
||||||
|
variable: __.http_proxy.address
|
||||||
|
|
||||||
|
port:
|
||||||
|
description: Proxy port
|
||||||
|
type: port
|
||||||
|
default:
|
||||||
|
variable: __.http_proxy.port
|
||||||
|
...
|
||||||
|
|
||||||
|
We can see here, for example, that the `address` and `port` variables don't have
|
||||||
|
any `description` atribute. We need to add one, so we need to extend the type
|
||||||
|
defintions.
|
||||||
|
|
||||||
|
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_083/firefox/10-manual.yml
|
||||||
|
:language: yaml
|
||||||
|
:caption: The :file:`firefox/10-manual.yml` structure definition file with explicit redefinitions
|
||||||
|
|
||||||
|
..
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
manual:
|
||||||
|
description: Manual proxy configuration
|
||||||
|
disabled:
|
||||||
|
variable: _.proxy_mode
|
||||||
|
when_not: Manual proxy configuration
|
||||||
|
|
||||||
|
http_proxy:
|
||||||
|
description: HTTP Proxy
|
||||||
|
type: proxy
|
||||||
|
|
||||||
|
address:
|
||||||
|
redefine: true
|
||||||
|
default: null
|
||||||
|
description: HTTP proxy address
|
||||||
|
|
||||||
|
port:
|
||||||
|
redefine: true
|
||||||
|
default: 8080
|
||||||
|
description: HTTP proxy port
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
.. note:: Transforming an implicit defintion into an explicit redefinition is very simple; you just need to add the `redefine: true` attribute:
|
||||||
|
|
||||||
|
Let's launch the Rougail CLI:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_083/config/01/cmd_ro.txt
|
||||||
|
:class: terminal
|
||||||
|
|
||||||
|
..
|
||||||
|
rougail -m firefox/ -u yaml -yf config/01/config.yml
|
||||||
|
|
||||||
|
We have this output:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_083/config/01/output_ro.html
|
||||||
|
:class: output
|
||||||
|
|
||||||
|
..
|
||||||
|
Variables:
|
||||||
|
┣━━ 📓 Configure Proxy Access to the Internet: Manual proxy configuration ◀
|
||||||
|
┃ loaded from the YAML file "config/01/config.yml" (⏳ No proxy)
|
||||||
|
┗━━ 📂 Manual proxy configuration
|
||||||
|
┣━━ 📂 HTTP Proxy
|
||||||
|
┃ ┣━━ 📓 HTTP proxy address: http.proxy.net ◀ loaded from the YAML file
|
||||||
|
┃ ┃ "config/01/config.yml"
|
||||||
|
┃ ┗━━ 📓 HTTP proxy port: 3128 ◀ loaded from the YAML file
|
||||||
|
┃ "config/01/config.yml" (⏳ 8080)
|
||||||
|
┣━━ 📓 Also use this proxy for HTTPS: false ◀ loaded from the YAML file
|
||||||
|
┃ "config/01/config.yml" (⏳ true)
|
||||||
|
┣━━ 📂 HTTPS Proxy
|
||||||
|
┃ ┣━━ 📓 HTTPS proxy address: https.proxy.net ◀ loaded from the YAML file
|
||||||
|
┃ ┃ "config/01/config.yml" (⏳ http.proxy.net)
|
||||||
|
┃ ┗━━ 📓 HTTPS proxy port: 3128
|
||||||
|
┗━━ 📂 SOCKS Proxy
|
||||||
|
┣━━ 📓 SOCKS proxy address: http.proxy.net
|
||||||
|
┣━━ 📓 SOCKS proxy port: 3128
|
||||||
|
┗━━ 📓 SOCKS host version used by proxy: v5
|
||||||
|
|
||||||
|
We can see in the output that the `address` and `port` variables have default values,
|
||||||
|
and descriptions ("HTTP proxy address", "HTTP proxy port") that weren't present in the
|
||||||
|
type definition file.
|
||||||
|
|
||||||
.. keypoints:: Key points
|
.. keypoints:: Key points
|
||||||
|
|
||||||
|
|
@ -399,5 +501,6 @@ FIXME : redéfinition explicites.
|
||||||
- more conscious family definition
|
- more conscious family definition
|
||||||
- using a type for an extended family definition
|
- using a type for an extended family definition
|
||||||
- we can redefine things in the structure file and it overloads the type definition file
|
- we can redefine things in the structure file and it overloads the type definition file
|
||||||
|
- implicit or explicit redefinitions
|
||||||
|
|
||||||
We have seen how the definition of type, used effectively, allows for a new expressiveness.
|
We have seen how the definition of type, used effectively, allows for a new expressiveness.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue