rougail/docs/tutorial/proxymode.rst

113 lines
3.2 KiB
ReStructuredText
Raw Normal View History

2024-10-15 18:17:21 +02:00
The `proxy` family
2024-10-28 21:08:22 +01:00
====================
.. objectives:: Objectives
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
We will learn how to:
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
- create a :term:`family`
- gather variables into a family
- make a variable in a variable, which is a family too
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
.. type-along:: Reminders
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
- As a prerequisite we have an idea of what a :term:`structure file description <dictionary>` is.
- We have a :file:`firefox` folder and we are putting all the structure description files in it.
- We had at the :term:`structure description file <structure file>`
A `manual` family
--------------------
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_020/firefox/10-manual.yml
2024-10-15 18:17:21 +02:00
:linenos:
2024-10-28 21:08:22 +01:00
:language: yaml
:caption: A family structure file description named `manual` in the :file:`firefox/10-manual.yml` file
:name: RougailFirstDictionary
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
..
2024-10-15 18:17:21 +02:00
---
2024-10-28 21:08:22 +01:00
manual:
description: Manual proxy configuration
2024-10-15 18:17:21 +02:00
type: family
We can see that we have defined a :term:`family` here, and this family is *empty*
(that is, the family container contains no variable yet).
.. admonition:: If a family is empty
2024-10-28 21:08:22 +01:00
We need to specify the :term:`family` type here because if we don't,
2024-10-15 18:17:21 +02:00
the Rougail's type engine will infer it by default as a :term:`variable`.
2024-10-28 21:08:22 +01:00
It's because we don't have set any :term:`variable` inside. If we make a YAML block
(that is, if we indent), the Rougail's type inference engine will implicitely make it a family.
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
.. note:: The variables, families, etc. will be created in several files for educational purposes.
2024-10-15 18:17:21 +02:00
Obviously all the variables can be put in the same file.
2024-10-28 21:08:22 +01:00
A family inside a family
----------------------------
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
Creating a family hierarchy is very easy, here is an example
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_021/firefox/10-manual.yml
2024-10-15 18:17:21 +02:00
:linenos:
:language: yaml
2024-10-28 21:08:22 +01:00
:caption: A rougail structure description file with a hierarchy.
:name: RougailFirstFamilyHierarchy
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
..
---
manual:
description: Manual proxy configuration
type: family
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
http_proxy:
description: HTTP Proxy
type: family
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
Here the `http_proxy` family lives inside the `manual` family.
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
Put a variable inside a family or a sub family
--------------------------------------------------
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
Let's create a variable in its family with a description and a default value.
The type of this variable is a `choice` type:
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_022/firefox/10-manual.yml
:linenos:
:language: yaml
:caption: An `address` variable in the `http_proxy` family
:name: RougailVariableInSubFamily
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
..
---
manual:
description: Manual proxy configuration
type: family
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
http_proxy:
description: HTTP Proxy
type: family
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
address:
description: HTTP address
2024-10-15 18:17:21 +02:00
2024-10-28 21:21:56 +01:00
The :term:`operator` can then set :term:`a value <value>` to the :confval:`adress` variable
.. confval:: address
:type: `string` (a *domain name*)
:default: None
This is a setting that controls the value of the answer.
2024-10-28 21:08:22 +01:00
.. keypoints:: Key points progress
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
**Keywords**
2024-10-15 18:17:21 +02:00
2024-10-28 21:08:22 +01:00
- :term:`family`, and sub families
- variables defined in a family