Practice
Objectives
Now it’s your turn again. Try making some Rougail. At the same time, if you get stuck, you have the solutions in the Rougail tutorial code repository.
There is nothing new in the three next Firefox variables. So it is the time to practice what we’ve learned until now.
This page is divided in two parts for each variable:
Explain what we want to implement
Propose to you a solution
The best for you is to do this job on your own and compare your work to our propositions.
Here are the two first variables in the Firefox configuration’s widget:
The third appears only if we enable DNS over HTTPS with a custom providers, we have to set a Custom DNS URL.
These three variables are highlighted here in the lower part of the Firefox configuration’s widget:
Prerequisites
We assume that Rougail’s library is installed on your computer.
It is possible to retrieve the current state of the various Rougail files manipulated in this tutorial step by checking out the corresponding tag of the
rougail-tutorialsgit repository. Each tag corresponds to a stage of progress in the tutorial. Of course, you can also decide to copy/paste or download the tutorial files contents while following the tutorial steps.
If you want to follow this tutorial with the help of the corresponding rougail-tutorials git repository, this workshop page corresponds to the tags 1.1_160 to 1.1_162 in the repository.
git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git
git switch --detach 1.1_160
A boolean variable
What do we want to be implemented
Exercice
You need to think about:
choose a file name that respect the file naming and organizing convention
define an appropriate family and variable name, have a look at our variable naming convention
we will set the variable in a family (with others variable later) to separate this purpose
the family and variable
descriptionparameter will be the Firefox descriptionthe variable is a boolean with the default value
false(unchecked option)the family and variable are always available, it’s not directly related to the proxy choice
Our solution
Please unroll the “Solution” widget to see our solution:
Solution
firefox/60-dns_over_https.yml a boolean variable%YAML 1.2
---
version: 1.1
dns_over_https: # DNS over HTTPS
enable_dns_over_https: false # Enable DNS over HTTPS
...
Here we choosed to name the new structure file
firefox/60-dns_over_https.yml, the file containing thedns_over_httpsfamily and theenable_dns_over_httpsvariable definitionthis variable is a boolean with the default value
false
A choice variable
What do we want to be implemented
Exercice
You need to think about:
this variable will be in the same file as the first one
define an appropriate variable name, have a look at our variable naming convention
we will set the variable in the previous family
the variable
descriptionparameter will be the Firefox descriptionthe variable is a choice with the following proposal:
Cloudflare,NextDNSandCustomthis variable shall be disabled if the
enable_dns_over_httpsvariable isfalse.
Our solution
For those who follow the tutorial with the help of the git repository
Now you need to checkout the v1.1_161 version:
git switch --detach v1.1_161
Please unroll the “Solution” widget to see our solution:
Solution
firefox/60-dns_over_https.yml a choice variable%YAML 1.2
---
version: 1.1
dns_over_https: # DNS over HTTPS
enable_dns_over_https: false # Enable DNS over HTTPS
provider:
description: Use Provider
choices:
- Cloudflare
- NextDNS
- Custom
default: Cloudflare
disabled:
variable: _.enable_dns_over_https
when: false
...
Here we choosed to name the new structure file
firefox/60-dns_over_https.yml, the file containing thedns_over_httpsfamily and theenable_dns_over_httpsvariable definitionthis variable is false by default
this variable is disabled if
enable_dns_over_httpsisfalse
A web_address variable
What do we want to be implemented
Exercice
You need to think about:
this variable will be in the same file as the two others
define an appropriate variable name, have a look at our variable naming convention
we will set the variable in the previous family
the variable
descriptionparameter will be the Firefox descriptionthe variable is a
web_addressthis variable shall be disabled if the
providervariable is notCustomthe variable
providercould be disabled too
Our solution
For those who follow the tutorial with the help of the git repository
Now you need to checkout the v1.1_162 version:
git switch --detach v1.1_162
Please unroll the “Solution” widget to see our solution:
Solution
firefox/60-dns_over_https.yml a choice variable%YAML 1.2
---
version: 1.1
dns_over_https: # DNS over HTTPS
enable_dns_over_https: false # Enable DNS over HTTPS
provider:
description: Use Provider
choices:
- Cloudflare
- NextDNS
- Custom
default: Cloudflare
disabled:
variable: _.enable_dns_over_https
when: false
custom_dns_url:
description: Custom DNS URL
type: web_address
disabled:
jinja: |-
{{ _.provider is propertyerror or _.provider != 'Custom' }}
return_type: boolean
description: if "_.provider" is not "Custom"
...
Here we choosed to name the new structure file
firefox/60-dns_over_https.yml, the file containing thecustom_dns_urlvariable definitionthis is a web_address variable
this variable is disabled if
providerhas an access property error andproviderhas not the value “Custom”