mirror of
https://github.com/YunoHost-Apps/leed_ynh.git
synced 2024-09-03 19:26:32 +02:00
Use actions.toml
This commit is contained in:
parent
58c89c4dee
commit
9773112a00
3 changed files with 22 additions and 38 deletions
20
actions.json
20
actions.json
|
@ -1,20 +0,0 @@
|
|||
[{
|
||||
"id": "public_private",
|
||||
"name": "Move to public or private",
|
||||
"command": "/bin/bash scripts/actions/public_private",
|
||||
"user": "root",
|
||||
"accepted_return_codes": [0],
|
||||
"description": {
|
||||
"en": "Change the public access of the app."
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public app ?"
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}]
|
14
actions.toml
Normal file
14
actions.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[public_private]
|
||||
name = "Move to public or private"
|
||||
command = "/bin/bash scripts/actions/public_private"
|
||||
# user = "root" # optional
|
||||
# cwd = "/" # optional
|
||||
# accepted_return_codes = [0, 1, 2, 3] # optional
|
||||
accepted_return_codes = [0]
|
||||
description = "Change the public access of the app."
|
||||
|
||||
[public_private.arguments]
|
||||
[public_private.arguments.is_public]
|
||||
type = "boolean"
|
||||
ask = "Is it a public app ?"
|
||||
default = true
|
|
@ -29,37 +29,25 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
|
||||
# is_public
|
||||
old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)"
|
||||
ynh_debug -m "old_is_public=$old_is_public"
|
||||
# old_is_public=$(bool_to_true_false $old_is_public)
|
||||
# ynh_debug -m "old_is_public=$old_is_public"
|
||||
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
||||
ynh_debug -m "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC"
|
||||
ynh_debug -m "is_public=$is_public"
|
||||
|
||||
# Overwrite nginx configuration
|
||||
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
|
||||
# old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
|
||||
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
||||
ynh_debug -m "overwrite_nginx=$overwrite_nginx"
|
||||
|
||||
# Overwrite php-fpm configuration
|
||||
old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)"
|
||||
# old_overwrite_phpfpm=$(bool_to_true_false $old_overwrite_phpfpm)
|
||||
overwrite_phpfpm="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM:-$old_overwrite_phpfpm}"
|
||||
ynh_debug -m "overwrite_phpfpm=$overwrite_phpfpm"
|
||||
|
||||
|
||||
# Type of admin mail configuration
|
||||
old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=admin_mail_html)"
|
||||
# old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html)
|
||||
admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
|
||||
ynh_debug -m "admin_mail_html=$admin_mail_html"
|
||||
|
||||
|
||||
# Footprint for php-fpm
|
||||
old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)"
|
||||
fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}"
|
||||
ynh_debug -m "fpm_footprint=$fpm_footprint"
|
||||
|
||||
# Free footprint value for php-fpm
|
||||
# Check if fpm_footprint is an integer
|
||||
|
@ -67,16 +55,15 @@ if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null
|
|||
then
|
||||
# If fpm_footprint is an integer, that's a numeric value for the footprint
|
||||
old_free_footprint=$fpm_footprint
|
||||
fpm_footprint=specific
|
||||
else
|
||||
old_free_footprint=0
|
||||
fi
|
||||
free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}"
|
||||
ynh_debug -m "free_footprint=$free_footprint"
|
||||
|
||||
# Usage for php-fpm
|
||||
old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)"
|
||||
fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"
|
||||
ynh_debug -m "fpm_usage=$fpm_usage"
|
||||
|
||||
#=================================================
|
||||
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
||||
|
@ -121,10 +108,8 @@ apply_config() {
|
|||
#=================================================
|
||||
|
||||
# Set overwrite_nginx
|
||||
# overwrite_nginx=$(bool_to_01 $overwrite_nginx)
|
||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
|
||||
# Set overwrite_phpfpm
|
||||
# overwrite_phpfpm=$(bool_to_01 $overwrite_phpfpm)
|
||||
ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value="$overwrite_phpfpm"
|
||||
|
||||
#=================================================
|
||||
|
@ -132,7 +117,6 @@ apply_config() {
|
|||
#=================================================
|
||||
|
||||
# Set admin_mail_html
|
||||
# admin_mail_html=$(bool_to_01 $admin_mail_html)
|
||||
ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
|
||||
|
||||
#=================================================
|
||||
|
@ -146,7 +130,13 @@ apply_config() {
|
|||
then
|
||||
fpm_footprint=$free_footprint
|
||||
fi
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
if [ "$fpm_footprint" != "0" ]
|
||||
then
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
else
|
||||
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue