This commit is contained in:
egarette@silique.fr 2025-12-29 12:53:08 +01:00
parent 11a251ed88
commit e701eba1d9
6 changed files with 173 additions and 18 deletions

28
README.fr.md Normal file
View file

@ -0,0 +1,28 @@
---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
## Charger les variables d'environnement
> [!NOTE]
>
> Les valeurs des variables peuvent être définies directement à partir d'une variable d'environnement.\
> \
> Les noms des variables d\'environnement commencent par un préfixe (par défaut ROUGAIL_) suivi du chemin de la variable en majuscules, par exemple : ROUGAIL_MA_VARIABLE. Si vous utilisez des espaces de noms, le préfixe sera le nom de l'espace de noms en majuscule.\
> \
> Notez que les chemins des variables peuvent contenir des points (« . »), qui ne sont pas autorisés partout. Pour éviter tout problème, utilisez la commande `env`, par exemple : `env ROUGAIL_MA_FAMILLE.MA_VARIABLE=1 rougail`.\
> \
> Pour les valeurs, il n'y a pas de différence entre un nombre et une lettre (ils peuvent être entre guillemets ou non). Cependant, les booléens sont True ou False. Le séparateur pour les variables multiple est la virgule.\
> **Chemin** : environment\
> *`désactivé`*\
> **Désactivé** : si environment n'est pas défini dans "[Sélection pour données utilisateur](#step.user_data)"
| Variable | Description | Valeur par défaut | Type | Validateur |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|---------------------------------------------------------------------------------------------------|------------------------------------------------------|
| **<a id="environment.default_environment_name" name="environment.default_environment_name">environment.default_environment_name</a>**<br/>**Ligne de commande** : <br/>--environment.default_environment_name<br/>**Variable d'environnement** : ENVIRONMENT.DEFAULT_ENVIRONMENT_NAME | Nom du préfix d&#x27;environnement par défaut. | ROUGAIL | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | Doit seulement utiliser des caractères en majuscule. |
| **<a id="environment.custom_separator" name="environment.custom_separator">environment.custom_separator</a>**<br/>**Ligne de commande** : <br/>--environment.custom_separator<br/>**Variable d'environnement** : ENVIRONMENT.CUSTOM_SEPARATOR | Remplace le caractère séparateur « . » dans les chemins par un autre.<br/>Le caractère point (« . ») peut ne pas être autorisé dans le nom de la variable d&#x27;environnement. Attention, le nom de la variable avec des points est toujours disponible en plus du nom avec ce caractère. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) | |
| **<a id="environment.with_secrets" name="environment.with_secrets">environment.with_secrets</a>**<br/>**Ligne de commande** : <br/>&nbsp;--environment.with_secrets<br/>&nbsp;--environment.no-with_secrets<br/>**Variable d'environnement** : ENVIRONMENT.WITH_SECRETS | Les variables d&#x27;environnement peuvent contenir des secrets. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | |

View file

@ -1,2 +1,28 @@
# rougail-user-data-environment
---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
## Load environment variables
> [!NOTE]
>
> Variable values can be defined directly from an environment variable.\
> \
> Environnement variable names begin with a prefix (by default ROUGAIL_) followed by the variable path in uppercase, for example: ROUGAIL_MY_VARIABLE. If you are using namespaces, the prefix is the name of the namespace in uppercase.\
> \
> Note that variable paths can contain dots ("."), which are not permitted everywhere. To avoid any issues, use the `env` command, for example: `env ROUGAIL_MY_FAMILY.MY_VARIABLE=1 rougail`.\
> \
> For values, there is no difference between a number and a letter (they can be enclosed in quotes or not). However, booleans are True or False. The separator for multiple variables is a comma.\
> **Path**: environment\
> *`disabled`*\
> **Disabled**: if environment is not set in "[Select for user datas](#step.user_data)"
| Variable | Description | Default value | Type | Validator |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|-------------------------------------------------------------------------------------------------|--------------------------------------|
| **<a id="environment.default_environment_name" name="environment.default_environment_name">environment.default_environment_name</a>**<br/>**Command line**: <br/>--environment.default_environment_name<br/>**Environment variable**: ENVIRONMENT.DEFAULT_ENVIRONMENT_NAME | Name of the default environment prefix. | ROUGAIL | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Should only use uppercase character. |
| **<a id="environment.custom_separator" name="environment.custom_separator">environment.custom_separator</a>**<br/>**Command line**: <br/>--environment.custom_separator<br/>**Environment variable**: ENVIRONMENT.CUSTOM_SEPARATOR | Replace the separator character &quot;.&quot; in path by an other.<br/>The character dot (&quot;.&quot;) may not be allowed in the environment variable name. Note that the variable name with dots is always available in addition to the name with this character. | | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) | |
| **<a id="environment.with_secrets" name="environment.with_secrets">environment.with_secrets</a>**<br/>**Command line**: <br/>&nbsp;--environment.with_secrets<br/>&nbsp;--environment.no-with_secrets<br/>**Environment variable**: ENVIRONMENT.WITH_SECRETS | Environnement variables may contain secrets. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | |

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-10-04 17:04+0200\n"
"PO-Revision-Date: 2025-10-04 17:04+0200\n"
"POT-Creation-Date: 2025-12-29 17:45+0100\n"
"PO-Revision-Date: 2025-12-29 17:52+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -14,7 +14,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.7\n"
"X-Generator: Poedit 3.8\n"
#: src/rougail/user_data_environment/annotator.py:46
msgid ""
@ -33,16 +33,77 @@ msgstr ""
"utiliser de données utilisateur \"environment\", donc \"{0}\" est invalide"
#: src/rougail/user_data_environment/config.py:34
msgid "Configuration loading environment variables"
msgstr "Configuration le chargement des variables d'environnements"
msgid "Load environment variables"
msgstr "Charger les variables d'environnement"
#: src/rougail/user_data_environment/config.py:36
msgid "Variable values can be defined directly from an environment variable."
msgstr ""
"Les valeurs des variables peuvent être définies directement à partir d'une "
"variable d'environnement."
#: src/rougail/user_data_environment/config.py:38
msgid ""
"Environnement variable names begin with a prefix (by default ROUGAIL_) "
"followed by the variable path in uppercase, for example: "
"ROUGAIL_MY_VARIABLE. If you are using namespaces, the prefix is the name of "
"the namespace in uppercase."
msgstr ""
"Les noms des variables d\\'environnement commencent par un préfixe (par "
"défaut ROUGAIL_) suivi du chemin de la variable en majuscules, par exemple : "
"ROUGAIL_MA_VARIABLE. Si vous utilisez des espaces de noms, le préfixe sera "
"le nom de l'espace de noms en majuscule."
#: src/rougail/user_data_environment/config.py:40
msgid ""
"Note that variable paths can contain dots (\".\"), which are not permitted "
"everywhere. To avoid any issues, use the `env` command, for example: `env "
"ROUGAIL_MY_FAMILY.MY_VARIABLE=1 rougail`"
msgstr ""
"Notez que les chemins des variables peuvent contenir des points (« . »), qui "
"ne sont pas autorisés partout. Pour éviter tout problème, utilisez la "
"commande `env`, par exemple : `env ROUGAIL_MA_FAMILLE.MA_VARIABLE=1 rougail`"
#: src/rougail/user_data_environment/config.py:42
msgid ""
"For values, there is no difference between a number and a letter (they can "
"be enclosed in quotes or not). However, booleans are True or False. The "
"separator for multiple variables is a comma."
msgstr ""
"Pour les valeurs, il n'y a pas de différence entre un nombre et une lettre "
"(ils peuvent être entre guillemets ou non). Cependant, les booléens sont "
"True ou False. Le séparateur pour les variables multiple est la virgule."
#: src/rougail/user_data_environment/config.py:47
msgid "if environment is not set in \"step.user_data\""
msgstr "si environment n'est pas défini dans \"step.user_data\""
#: src/rougail/user_data_environment/config.py:50
msgid "Name of the default environment prefix"
msgstr "Nom du préfix d'environnement par défaut"
#: src/rougail/user_data_environment/config.py:49
#: src/rougail/user_data_environment/config.py:56
msgid "should only use uppercase character"
msgstr "doit seulement utiliser des caractères en majuscule"
#: src/rougail/user_data_environment/config.py:62
msgid "Replace the separator character \".\" in path by an other"
msgstr "Remplace le caractère séparateur « . » dans les chemins par un autre"
#: src/rougail/user_data_environment/config.py:63
msgid ""
"The character dot (\".\") may not be allowed in the environment variable "
"name. Note that the variable name with dots is always available in addition "
"to the name with this character."
msgstr ""
"Le caractère point (« . ») peut ne pas être autorisé dans le nom de la "
"variable d'environnement. Attention, le nom de la variable avec des points "
"est toujours disponible en plus du nom avec ce caractère."
#: src/rougail/user_data_environment/config.py:67
msgid "Environnement variables may contain secrets"
msgstr "Les variables d'environnement peuvent contenir des secrets"
#~ msgid "Define values from the environment"
#~ msgstr "Défini les valeurs pour l'environnemnt"
#~ msgid "The \".\" character could be not allowed in path name"
#~ msgstr ""
#~ "Le caractère \".\" peut ne pas être autorisé dans le nom des chemins"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-10-04 17:05+0200\n"
"POT-Creation-Date: 2025-12-29 17:52+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -24,14 +24,46 @@ msgid "variable name must be a lowercase name when we want to use user data \"en
msgstr ""
#: src/rougail/user_data_environment/config.py:34
msgid "Configuration loading environment variables"
msgid "Load environment variables"
msgstr ""
#: src/rougail/user_data_environment/config.py:36
msgid "Variable values can be defined directly from an environment variable."
msgstr ""
#: src/rougail/user_data_environment/config.py:38
msgid "Environnement variable names begin with a prefix (by default ROUGAIL_) followed by the variable path in uppercase, for example: ROUGAIL_MY_VARIABLE. If you are using namespaces, the prefix is the name of the namespace in uppercase."
msgstr ""
#: src/rougail/user_data_environment/config.py:40
msgid "Note that variable paths can contain dots (\".\"), which are not permitted everywhere. To avoid any issues, use the `env` command, for example: `env ROUGAIL_MY_FAMILY.MY_VARIABLE=1 rougail`"
msgstr ""
#: src/rougail/user_data_environment/config.py:42
msgid "For values, there is no difference between a number and a letter (they can be enclosed in quotes or not). However, booleans are True or False. The separator for multiple variables is a comma."
msgstr ""
#: src/rougail/user_data_environment/config.py:47
msgid "if environment is not set in \"step.user_data\""
msgstr ""
#: src/rougail/user_data_environment/config.py:50
msgid "Name of the default environment prefix"
msgstr ""
#: src/rougail/user_data_environment/config.py:49
#: src/rougail/user_data_environment/config.py:56
msgid "should only use uppercase character"
msgstr ""
#: src/rougail/user_data_environment/config.py:62
msgid "Replace the separator character \".\" in path by an other"
msgstr ""
#: src/rougail/user_data_environment/config.py:63
msgid "The character dot (\".\") may not be allowed in the environment variable name. Note that the variable name with dots is always available in addition to the name with this character."
msgstr ""
#: src/rougail/user_data_environment/config.py:67
msgid "Environnement variables may contain secrets"
msgstr ""

View file

@ -31,12 +31,20 @@ def get_rougail_config(
) -> dict:
options = f"""
environment:
description: {_("Configuration loading environment variables")}
description: {_("Load environment variables")}
help: |-
{_('Variable values can be defined directly from an environment variable.')}
{_('Environnement variable names begin with a prefix (by default ROUGAIL_) followed by the variable path in uppercase, for example: ROUGAIL_MY_VARIABLE. If you are using namespaces, the prefix is the name of the namespace in uppercase.')}
{_('Note that variable paths can contain dots ("."), which are not permitted everywhere. To avoid any issues, use the `env` command, for example: `env ROUGAIL_MY_FAMILY.MY_VARIABLE=1 rougail`')}
{_('For values, there is no difference between a number and a letter (they can be enclosed in quotes or not). However, booleans are True or False. The separator for multiple variables is a comma.')}
disabled:
jinja: |
{{% if _.step.user_data is propertyerror or 'environment' not in _.step.user_data %}}
disabled
{{% endif %}}
{{{{ _.step.user_data is propertyerror or 'environment' not in _.step.user_data }}}}
return_type: boolean
description: {_('if environment is not set in "step.user_data"')}
default_environment_name:
description: {_("Name of the default environment prefix")}
@ -45,14 +53,14 @@ environment:
- jinja: |-
{{{{ _.default_environment_name | upper != _.default_environment_name }}}}
return_type: boolean
description: {_("should only user uppercase character")}
description: {_("should only use uppercase character")}
disabled:
variable: __.main_namespace
when_not: null
custom_separator:
description: {_('Replace the separator character "." in path by an other')}
help: {_('The "." character could be not allowed in path name')}
help: {_('The character dot (".") may not be allowed in the environment variable name. Note that the variable name with dots is always available in addition to the name with this character.')}
mandatory: false
with_secrets: