calculated comments ok

This commit is contained in:
gwen 2026-01-19 14:33:11 +01:00
parent 9c9c313681
commit a346e23af6

View file

@ -1,12 +1,11 @@
Calculated default value for a variable
============================================
.. objectives:: Objectives
In this section we will reuse a value of a variable for another variable.
In fact in this use case we will reuse the default value of a variable
in order to define a default value of another variable.
In this section we will reuse the value of a variable for the default value of another variable.
We will first build the `https_proxy` family which will be used to illustrate this functionality.
.. prerequisites:: Prerequisites
@ -29,15 +28,17 @@ Calculated default value for a variable
HTTPS family
-------------
We have split the definition of the `manual` familiy into two specific files,
We have split the definition of the `manual` family into two specific files,
the :file:`10-manual.yml` and the :file:`20-manual.yml` structure file:
.. raw:: html
:class: output
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_042/tree.html
As a reminder, here is the :file:`20-manual.yml` structure file, which looks like the :file:`10-manual.yml` file
except that it is dedicated to the HTTPS protocol :ref:`and a boolean variable that we saw earlier <boolean_variable>`:
We will continue to complete the :file:`20-manual.yml` structure file,
with variables entirely equivalent to those found in the `http_proxy` family the :file:`10-manual.yml` structure file.
Until now, we only had the `use_for_https` :ref:`boolean variable in this structure file <boolean_variable>`.
Now we are going to define an address and a port in the `https_proxy` family:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_040/firefox/20-manual.yml
:linenos:
@ -66,8 +67,6 @@ except that it is dedicated to the HTTPS protocol :ref:`and a boolean variable t
type: port
default: 8080
This `https_proxy` family is identical to the `http_proxy` family except that it defines variables intended for the HTTPS protocol.
A default value calculated from another variable
--------------------------------------------------
@ -79,14 +78,17 @@ A default value calculated from another variable
.. discussion:: A contextualized default value
A contextualized default value is a default value of a variable that has the value of another variable.
This variable type and its parameters type are copied in the default value's target variable.
A contextualized default value is a default value that changes according to the overall context of the configuration.
A contextualized default value can come from, as we see here, a copy of the value of another variable.
The dynamic setting of a default can be expressed this way: the default value is a pointer to another variable's value.
Here, the defaut value of `manual.https_proxy.address` points to the default value of `manual.http_proxy.address`.
Here, the defaut value of `manual.https_proxy.address` points to the value of `manual.http_proxy.address`.
This is the same thing for the default value of the `manual.https_proxy.port` variable,
which points to the `manual.http_proxy.port` default value.
which points to the `manual.http_proxy.port` value.
.. note:: In the following we will see that the `manual.https_proxy.address` type is `domainname`.
Indeed, the the default value inherits the type of the value it points to.
Reminder: here is the HTTP :file:`firefox/10-manual.yml` structure file:
@ -117,7 +119,7 @@ Reminder: here is the HTTP :file:`firefox/10-manual.yml` structure file:
...
And here is the :file:`firefox/20-manual.yml` structure files where the calculated default values are:
And here is the :file:`firefox/20-manual.yml` structure file where the calculated default values are:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_041/firefox/20-manual.yml
:linenos:
@ -146,7 +148,7 @@ And here is the :file:`firefox/20-manual.yml` structure files where the calculat
variable: __.http_proxy.port
...
We can see here that the `address` variable's default value is contitionned by the `__.http_proxy.address` variable's value.
We can see here that the `address` variable's default value is conditionned by the `__.http_proxy.address` variable's value.
The target variable is `http_proxy.address`.
.. note:: The `__.` notation means the parent path of the current subfamily path.