mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
Fix config
This commit is contained in:
parent
a89399ffbd
commit
9efa200f29
3 changed files with 42 additions and 10 deletions
|
@ -13,7 +13,7 @@
|
|||
{
|
||||
"name": "Is it a public app ?",
|
||||
"id": "is_public",
|
||||
"type": "boolean",
|
||||
"type": "bool",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
@ -26,14 +26,14 @@
|
|||
"name": "Overwrite the nginx config file ?",
|
||||
"help": "If the file is overwritten, a backup will be created.",
|
||||
"id": "overwrite_nginx",
|
||||
"type": "boolean",
|
||||
"type": "bool",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "Overwrite the gitlab.rb config file ?",
|
||||
"help": "If the file is overwritten, a backup will be created.",
|
||||
"id": "overwrite_gitlab_config",
|
||||
"type": "boolean",
|
||||
"type": "bool",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
@ -46,7 +46,7 @@
|
|||
"name": "Authorized external user creation ?",
|
||||
"help": "Allow user to be created without yunohost account.",
|
||||
"id": "use_web_account",
|
||||
"type": "boolean",
|
||||
"type": "bool",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -14,6 +14,24 @@ IS_PACKAGE_CHECK () {
|
|||
return $(env | grep -c container=lxc)
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# BOOLEAN CONVERTER
|
||||
#=================================================
|
||||
|
||||
bool_to_01 () {
|
||||
local var="$1"
|
||||
[ "$var" = "true" ] && var=1
|
||||
[ "$var" = "false" ] && var=0
|
||||
echo "$var"
|
||||
}
|
||||
|
||||
bool_to_true_false () {
|
||||
local var="$1"
|
||||
[ "$var" = "1" ] && var=true
|
||||
[ "$var" = "0" ] && var=false
|
||||
echo "$var"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# WAIT
|
||||
#=================================================
|
||||
|
|
|
@ -27,19 +27,23 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
|||
|
||||
# is_public
|
||||
old_is_public="$(ynh_app_setting_get $app is_public)"
|
||||
old_is_public=$(bool_to_true_false $old_is_public)
|
||||
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
||||
|
||||
# Overwrite nginx configuration
|
||||
old_overwrite_nginx="$(ynh_app_setting_get $app overwrite_nginx)"
|
||||
old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
|
||||
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
||||
|
||||
# Overwrite gitlab.rb configuration
|
||||
old_overwrite_gitlab_config="$(ynh_app_setting_get $app overwrite_gitlab_config)"
|
||||
old_overwrite_gitlab_config=$(bool_to_true_false $old_overwrite_gitlab_config)
|
||||
overwrite_gitlab_config="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_GITLAB_CONFIG:-$old_overwrite_gitlab_config}"
|
||||
|
||||
# use_web_account
|
||||
old_use_web_account="$(ynh_app_setting_get $app use_web_account)"
|
||||
use_web_account="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
|
||||
old_use_web_account=$(bool_to_true_false $old_use_web_account)
|
||||
use_web_account="${YNH_CONFIG_MAIN_USERS_USE_WEB_ACCOUNT:-$old_use_web_account}"
|
||||
|
||||
#=================================================
|
||||
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
||||
|
@ -63,10 +67,20 @@ show_config() {
|
|||
|
||||
apply_config() {
|
||||
# Change public accessibility
|
||||
yunohost app action run $app public_private --args $is_public
|
||||
if [ "$is_public" = "true" ]
|
||||
then
|
||||
yunohost app action run $app public_private --args is_public=1
|
||||
else
|
||||
yunohost app action run $app public_private --args is_public=0
|
||||
fi
|
||||
|
||||
# Change use_web_account
|
||||
yunohost app action run $app web_account --args $use_web_account
|
||||
if [ "$use_web_account" = "true" ]
|
||||
then
|
||||
yunohost app action run $app web_account --args use_web_account=1
|
||||
else
|
||||
yunohost app action run $app web_account --args use_web_account=0
|
||||
fi
|
||||
|
||||
# Set overwrite_nginx
|
||||
ynh_app_setting_set $app overwrite_nginx "$overwrite_nginx"
|
||||
|
@ -81,6 +95,6 @@ apply_config() {
|
|||
#=================================================
|
||||
|
||||
case $1 in
|
||||
show) show_config ;;
|
||||
apply) apply_config ;;
|
||||
esac
|
||||
show) show_config;;
|
||||
apply) apply_config;;
|
||||
esac
|
Loading…
Reference in a new issue