helpers: add new --group option for ynh_add_fpm_config to customize the Group parameter

This commit is contained in:
Alexandre Aubin 2023-08-31 17:23:21 +02:00
parent b0fe49ae83
commit 65d2571072

View file

@ -70,8 +70,9 @@ YNH_PHP_VERSION=${YNH_PHP_VERSION:-$YNH_DEFAULT_PHP_VERSION}
ynh_add_fpm_config() { ynh_add_fpm_config() {
local _globalphpversion=${phpversion-:} local _globalphpversion=${phpversion-:}
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vufpd local legacy_args=vufpdg
local -A args_array=([v]=phpversion= [u]=usage= [f]=footprint= [p]=package= [d]=dedicated_service) local -A args_array=([v]=phpversion= [u]=usage= [f]=footprint= [p]=package= [d]=dedicated_service [g]=group=)
local group
local phpversion local phpversion
local usage local usage
local footprint local footprint
@ -80,6 +81,7 @@ ynh_add_fpm_config() {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
package=${package:-} package=${package:-}
group=${group:-}
# The default behaviour is to use the template. # The default behaviour is to use the template.
local autogenconf=false local autogenconf=false
@ -180,12 +182,13 @@ ynh_add_fpm_config() {
# Define the values to use for the configuration of PHP. # Define the values to use for the configuration of PHP.
ynh_get_scalable_phpfpm --usage=$usage --footprint=$footprint ynh_get_scalable_phpfpm --usage=$usage --footprint=$footprint
local phpfpm_group=$([[ -n "$group" ]] && echo "$group" || echo "$app")
local phpfpm_path="$YNH_APP_BASEDIR/conf/php-fpm.conf" local phpfpm_path="$YNH_APP_BASEDIR/conf/php-fpm.conf"
echo " echo "
[__APP__] [__APP__]
user = __APP__ user = __APP__
group = __APP__ group = __PHPFPM_GROUP__
chdir = __INSTALL_DIR__ chdir = __INSTALL_DIR__