diff --git a/docs/tutorial/boolean.rst b/docs/tutorial/boolean.rst index a3f9d3b30..c318bb642 100644 --- a/docs/tutorial/boolean.rst +++ b/docs/tutorial/boolean.rst @@ -277,6 +277,74 @@ It is possible to add a `variable` parameter to the `hidden` attribute like this type: port default: 8080 +A calculated default value +------------------------------- + + +There is something left in the https configuration mode of the proxy: + +- if the use of the proxy variables for https are the same of the proxy variables for http, + that is, if `use_for_https` is true, the https configuration variables are hidden, that's OK. +- if the use of the proxy variables for https **are not** the same of the proxy variables for http, + we would like to set their default values to the http proxy variables values. + +By now, the default settings are set like this: + +.. code-block:: yaml + + port: + description: HTTPS Port + type: port + default: 8080 + + + +The dynamic setting of a default can be achieved in this way: + +.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_035/firefox/20-manual.yml + :language: yaml + :caption: A default variable's value dynamically set + +.. + --- + manual: + + use_for_https: + description: Also use this proxy for HTTPS + default: true + + https_proxy: + description: HTTPS Proxy + hidden: + variable: manual.use_for_https + + address: + description: HTTPS address + type: domainname + params: + allow_ip: true + default: + variable: manual.http_proxy.address + + port: + description: HTTPS Port + type: port + default: + variable: manual.http_proxy.port + +.. note:: This is just a pointer to another variable's value. + +The default values of the https address and port are pointing to the value of +the `manual.http_proxy.address` and the `manual.http_proxy.port` variables. + +.. glossary:: + + calculated + + We say that a variable's value or a default variable's value is calculated + when there is a pointer which refers to another variable's value + or if there is some :term:`jinja` code or a python function that calculates it. + .. keypoints:: Key points **Keywords** @@ -284,6 +352,7 @@ It is possible to add a `variable` parameter to the `hidden` attribute like this - The :term:`hidden` property set to a family - The fact that a property can be set dynamically - The conditional dependency of a `hidden` property that depends on a `boolean` variable. + - A calculated default value **Progress** diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 77fd3b876..fc9929440 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -43,5 +43,7 @@ At first glance we can see that we have a selection of five configuration option proxymode disabled boolean + +.. tutorial