rougail/docs/tutorial/boolean.rst

178 lines
5 KiB
ReStructuredText
Raw Normal View History

2025-05-14 13:17:08 +02:00
A new variable which has the `boolean` type
===============================================
.. objectives:: Objectives
In this section we will learn:
- how to make a boolean type variable
2025-05-26 22:09:29 +02:00
- how to reuse some value of a variable
(in this use case we will reuse the HTTP configuration variables values for the HTTPS configuration)
2025-05-14 13:17:08 +02:00
.. prerequisites:: Reminders
Let's summarize the configuration up to here
Whe have the `proxy_mode` configuration here:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/firefox/00-proxy.yml
:language: yaml
:caption: firefox/00-proxy.yml
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy
With the manual subfamily in case of the "Manual proxy configuration" configuration option has been chosen:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/firefox/10-manual.yml
:language: yaml
:caption: firefox/10-manual.yml
..
---
manual:
description: Manual proxy configuration
disabled:
variable: proxy_mode
when_not: 'Manual proxy configuration'
http_proxy:
description: HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
.. type-along:: The HTTPS mode
Now we will focus on configuring the HTTPS mode in case of "Manual proxy configuration".
.. image:: images/firefox_manual_https.png
2025-05-26 22:09:29 +02:00
Let's set two other variables for the HTTPS use only:
.. confval:: https_proxy.address
:type: `domainname`
This is an address setting for the manual HTTPS configuration
.. confval:: https_proxy.port
:type: `port`
This is a port setting for the manual HTTPS configuration
- So we have a `manual.http_proxy.address` variable and a `manual.https_proxy.address` variable
- In the same way, we have a `manual.http_proxy.port` variable and a `manual.https_proxy.port` variable
.. type-along:: What do we want to reuse?
2025-05-14 13:17:08 +02:00
Do we want to reuse, for the HTTPS mode, the same configuration as for the HTTP mode?
2025-05-26 22:09:29 +02:00
It depends on the situation.
2025-05-14 13:17:08 +02:00
A new `boolean` type variable
-------------------------------
We have a new variable, named `use_for_https` here:
.. confval:: use_for_https
:type: `boolean`
:default: `true`
This is a setting that enables to reuse the HTTP proxy configuration for HTTPS
Its description in the structure file gives us this:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/firefox/20-manual.yml
:language: yaml
:caption: firefox/20-manual.yml
..
---
manual:
use_for_https:
description: Also use this proxy for HTTPS
type: boolean
default: true
2025-05-26 22:09:29 +02:00
.. type-along:: Update on the situation
So now we have three new variables in the manual mode of the http proxy configuration.
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_032/firefox/20-manual.yml
:language: yaml
:caption: firefox/20-manual.yml
..
---
manual:
use_for_https:
description: Also use this proxy for HTTPS
default: true
https_proxy:
description: HTTPS Proxy
address:
description: HTTPS address
type: domainname
params:
allow_ip: true
port:
description: HTTPS Port
type: port
default: 8080
And with this :confval:`use_for_https` boolean variable, there are two possibilities, and only two:
- The http proxy's configuration will be reused for the https proxy's configuration
- The http proxy's will not be reused for the https proxy's configuration
.. questions:: Question: disabled?
2025-05-27 11:03:29 +02:00
Is it relevant to use the :term:`disabled property <disabled>` here?
2025-05-26 22:09:29 +02:00
2025-05-27 11:03:29 +02:00
**answer**: No! Because we *need* to use these variables at any case,
we simply have to point their values in one direction or another depending on this or that situation.
It is absolutely not a question of deactivating them. The :confval:`manual.https_proxy.address`
and the :confval:`manual.http_proxy.port` variables shall not be disabled (deactivated) in the manual mode.
Let's introduce here a new concept.
The hidden property
---------------------
.. glossary::
hidden
A variable or family's property is hidden if its value shall not be seen in a given consistency.
Anyway, these variables can be used again if the situation evolves. This is the main difference
between the `hidden` and the `disabled` properties.
2025-05-26 22:09:29 +02:00
..
How can we tell Rougail that this :confval:`use_for_https` boolean variable is used to enable/disable
the use of variables from the entire family?