mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Update doc about helper ynh_add_config
This commit is contained in:
parent
12764652b0
commit
4a9a3ba138
1 changed files with 37 additions and 1 deletions
|
@ -452,11 +452,16 @@ ynh_local_curl() {
|
|||
# usage: ynh_add_config --template="template" --destination="destination"
|
||||
# | arg: -t, --template= - Template config file to use
|
||||
# | arg: -d, --destination= - Destination of the config file
|
||||
# | arg: -j, --jinja - Use jinja template instead of legacy __MY_VAR__
|
||||
#
|
||||
# examples:
|
||||
# ynh_add_config --template=".env" --destination="$install_dir/.env" use the template file "../conf/.env"
|
||||
# ynh_add_config --jinja --template="config.j2" --destination="$install_dir/config" use the template file "../conf/config.j2"
|
||||
# ynh_add_config --template="/etc/nginx/sites-available/default" --destination="etc/nginx/sites-available/mydomain.conf"
|
||||
#
|
||||
##
|
||||
## How it works in "legacy" mode
|
||||
##
|
||||
# The template can be by default the name of a file in the conf directory
|
||||
# of a YunoHost Package, a relative path or an absolute path.
|
||||
#
|
||||
|
@ -480,6 +485,37 @@ ynh_local_curl() {
|
|||
# __VAR_2__ by $var_2
|
||||
# ```
|
||||
#
|
||||
##
|
||||
## When --jinja is enabled
|
||||
##
|
||||
# For a full documentation of the template you can refer to: https://jinja.palletsprojects.com/en/3.1.x/templates/
|
||||
# In Yunohost context there are no really some specificity except that all variable passed are of type string.
|
||||
# So here are some example of recommended usage:
|
||||
#
|
||||
# If you need a conditional block
|
||||
#
|
||||
# {% if should_my_block_be_shown == 'true' %}
|
||||
# ...
|
||||
# {% endif %}
|
||||
#
|
||||
# or
|
||||
#
|
||||
# {% if should_my_block_be_shown == '1' %}
|
||||
# ...
|
||||
# {% endif %}
|
||||
#
|
||||
# If you need to iterate with loop:
|
||||
#
|
||||
# {% for yolo in var_with_multiline_value.splitlines() %}
|
||||
# ...
|
||||
# {% endfor %}
|
||||
#
|
||||
# or
|
||||
#
|
||||
# {% for jail in my_var_with_coma.split(',') %}
|
||||
# ...
|
||||
# {% endfor %}
|
||||
#
|
||||
# The helper will verify the checksum and backup the destination file
|
||||
# if it's different before applying the new template.
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue