Add nodejs support in the config panel
This commit is contained in:
parent
1510b03634
commit
d180592b9d
2 changed files with 27 additions and 0 deletions
|
@ -52,6 +52,15 @@ name = "My Webapp configuration"
|
||||||
default = "low"
|
default = "low"
|
||||||
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."
|
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."
|
||||||
|
|
||||||
|
[main.nodejs]
|
||||||
|
name = "NodeJS configuration"
|
||||||
|
|
||||||
|
[main.nodejs.nodeversion]
|
||||||
|
ask = "NodeJS version"
|
||||||
|
type = "select"
|
||||||
|
choices = ["none", "18", "20", "21"]
|
||||||
|
default = "none"
|
||||||
|
|
||||||
# TODO: Add protected_path as tags, which are created as permission "label (path)", so admin can protect a specific path
|
# TODO: Add protected_path as tags, which are created as permission "label (path)", so admin can protect a specific path
|
||||||
# [main.permissions]
|
# [main.permissions]
|
||||||
# [main.permissions.proteced_path]
|
# [main.permissions.proteced_path]
|
||||||
|
|
|
@ -105,6 +105,11 @@ ynh_app_config_validate() {
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${changed[nodeversion]}" == "true" ] && [ $nodeversion != "none" ] && [ $phpversion != "none" ]
|
||||||
|
then
|
||||||
|
ynh_die --message="You cannot have both PHP and NodeJS, choose only one."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_app_config_apply() {
|
ynh_app_config_apply() {
|
||||||
|
@ -152,6 +157,19 @@ ynh_app_config_apply() {
|
||||||
then
|
then
|
||||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${changed[nodeversion]}" == "true" ]
|
||||||
|
then
|
||||||
|
if [ "$nodeversion" != "none" ]
|
||||||
|
then
|
||||||
|
ynh_install_nodejs --nodejs_version=$nodeversion
|
||||||
|
ynh_use_nodejs
|
||||||
|
export port=$(ynh_app_setting_get $app port)
|
||||||
|
ynh_setup_my_nodeapp --app=$app --install_dir=$install_dir
|
||||||
|
else
|
||||||
|
ynh_remove_my_nodeapp --app=$app
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ynh_app_config_run $1
|
ynh_app_config_run $1
|
||||||
|
|
Loading…
Add table
Reference in a new issue