rougail-tutorials/README.md

169 lines
5.7 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- [List of all the tutorial steps](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md)
- [[Previous tutorial v1.1_083] Redefine default value in custom type variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_083/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_084~1..v1.1_084))
# [tutorial v1.1_084] Redefine other parameter in custom type for HTTP
- [Read the tutorial "Redefine other parameter in custom type for HTTP" in the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/customtype.html#redefine-other-parameter-in-custom-type-for-http)
- [View the changes in the files](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_084~1..v1.1_084)
## Screenshot
<img src="firefox.png" width=50% height=50% alt="Firefox Proxy setting"/>
## Clone and install
To test this tutorial, you need to download this repository and install Rougail:
```shell
git clone -b 1.1 https://forge.cloud.silique.fr/stove/rougail-tutorials.git
cd rougail-tutorials
python -m venv venv_rougail
. venv_rougail/bin/activate
pip install rougail-cli rougail-output-exporter rougail-output-doc rougail-user-data-yaml
```
Then switch to the tutorial page:
```shell
git switch --detach v1.1_084
```
## Structure
<p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./">.</a><br/>
├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./firefox/">firefox</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
│   ├── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./firefox/10-manual.yml">10-manual.yml</a><br/>
│   └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./firefox/20-manual.yml">20-manual.yml</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./types/">types</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./types/proxy/">proxy</a><br/>
        └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_084/./types/proxy/00-type.yml">00-type.yml</a><br/>
<br/><br/></p>
Contents of the types/proxy/00-type.yml type file
```yml
%YAML 1.2
---
version: 1.1
proxy:
address:
type: domainname
params:
allow_ip: true
default:
variable: __.http_proxy.address
port:
type: port
default:
variable: __.http_proxy.port
...
```
***
Contents of the firefox/10-manual.yml file
```yml
%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
...
```
***
### Let's generate the documentation
```shell
rougail -m firefox/ --types types/proxy -o doc
```
[View the documentation file](DOCUMENTATION.md)
***
### Let's generate the changelog
```shell
rougail -m firefox/ --types types/proxy -o doc --doc.contents changelog --doc.changelog.previous_json_file previous.yml
```
[View the changelog file](CHANGELOG.md)
***
## User datas
### Example 1
#### config/01/config.yml
```yml
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: http.proxy.net
port: 3128
use_for_https: false
https_proxy:
address: https.proxy.net
```
***
#### Output
```shell
rougail -m firefox/ --types types/proxy -u yaml -yf config/01/config.yml
```
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #B8860B">Default value</span>
> - <span style="color: #006400">Modified value</span>
> - (:hourglass_flowing_sand: Original default value)
Variables:
- :notebook: proxy_mode (Configure Proxy Access to the Internet): <span style="color: #006400">Manual proxy configuration</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: No proxy)
- :open_file_folder: manual (Manual proxy configuration)
- :open_file_folder: http_proxy (HTTP Proxy)
- :notebook: address (HTTP proxy address): <span style="color: #006400">http.proxy.net</span> ← loaded from the YAML file "config/01/config.yml"
- :notebook: port (HTTP proxy port): <span style="color: #006400">3128</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: 8080)
- :notebook: use_for_https (Also use this proxy for HTTPS): <span style="color: #006400">false</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: true)
- :open_file_folder: https_proxy (HTTPS Proxy)
- :notebook: address: <span style="color: #006400">https.proxy.net</span> ← loaded from the YAML file "config/01/config.yml" (:hourglass_flowing_sand: http.proxy.net)
- :notebook: port: <span style="color: #B8860B">3128</span>
- :open_file_folder: socks_proxy (SOCKS Proxy)
- :notebook: address: <span style="color: #B8860B">http.proxy.net</span>
- :notebook: port: <span style="color: #B8860B">3128</span>
- :notebook: version (SOCKS host version used by proxy): <span style="color: #B8860B">v5</span>
***
- [[Next tutorial v1.1_085] Redefine other parameter in custom type for HTTPS et SOCKS](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_085/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_085~1..v1.1_085))