mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
configpanel phpversion
This commit is contained in:
parent
071d38bfb1
commit
17534e2819
2 changed files with 30 additions and 13 deletions
|
@ -21,21 +21,36 @@ name = "My webapp configuration"
|
|||
[main.php_fpm_config]
|
||||
name = "PHP-FPM configuration"
|
||||
|
||||
[main.php_fpm_config.phpversion]
|
||||
ask = "PHP version"
|
||||
choices = ["none", "7.3", "7.4", "8.0"]
|
||||
default = "none"
|
||||
|
||||
[main.php_fpm_config.fpm_footprint]
|
||||
ask = "Memory footprint of the service?"
|
||||
choices = ["low", "medium", "high", "specific"]
|
||||
default = "low"
|
||||
visible = "! match(phpversion, 'none')"
|
||||
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
|
||||
|
||||
[main.php_fpm_config.free_footprint]
|
||||
ask = "Memory footprint of the service?"
|
||||
type = "number"
|
||||
default = "0"
|
||||
visible = "match(fpm_footprint, 'specific')"
|
||||
visible = "match(fpm_footprint, 'specific') && ! match(phpversion, 'none')"
|
||||
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
|
||||
|
||||
[main.php_fpm_config.fpm_usage]
|
||||
ask = "Expected usage of the service?"
|
||||
choices = ["low", "medium", "high"]
|
||||
default = "low"
|
||||
visible = "! match(phpversion, 'none')"
|
||||
help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
|
||||
|
||||
# TODO: Add protected_path as tags, which are created as permission "label (path)", so admin can protect a specific path
|
||||
# [main.permissions]
|
||||
# [main.permissions.proteced_path]
|
||||
# ask = "Protected path"
|
||||
# help = "A permission will be created so you can restrict the access to a subpath of the web app."
|
||||
# type = "tags"
|
||||
|
|
@ -17,16 +17,6 @@ ynh_abort_if_errors
|
|||
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
|
||||
is_password_exist=0
|
||||
current_password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
if [ -n "$current_password" ]
|
||||
then
|
||||
is_password_exist=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
||||
#=================================================
|
||||
|
@ -109,13 +99,25 @@ ynh_app_config_validate() {
|
|||
ynh_app_config_apply() {
|
||||
_ynh_app_config_apply
|
||||
|
||||
# If there's any change to the php config, remove the old one and add a new one if applicable
|
||||
if [ "${changed[phpversion]}" == "true" ] || "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then
|
||||
ynh_remove_fpm_config
|
||||
|
||||
if [[ ! "$phpversion" == "none" ]]; then
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! $phpversion == "none" ]]
|
||||
then
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
fi
|
||||
|
||||
if [ $with_sftp -eq 1 ]
|
||||
then
|
||||
ynh_system_user_add_group --username=$app --groups="sftp.app"
|
||||
|
||||
if [ ! $password -eq "" ]
|
||||
if [[ ! $password == "" ]]
|
||||
then
|
||||
chpasswd <<< "${app}:${password}"
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue