1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
This commit is contained in:
ericgaspar 2021-05-17 09:45:06 +02:00
parent b9c6ab427f
commit d81f42a5be
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 28 additions and 14 deletions

View file

@ -1,9 +1,9 @@
;; General ;; General
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1

View file

@ -23,7 +23,7 @@
"mysql" "mysql"
], ],
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.2.4"
}, },
"arguments": { "arguments": {
"install" : [ "install" : [

View file

@ -45,8 +45,8 @@ config_gogs() {
fi fi
ynh_replace_string "__REPOS_PATH__" "$REPO_PATH" "$final_path/custom/conf/app.ini" ynh_replace_string "__REPOS_PATH__" "$REPO_PATH" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DB_PWD__" "$dbpass" "$final_path/custom/conf/app.ini" ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DB_NAME__" "$dbuser" "$final_path/custom/conf/app.ini" ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/custom/conf/app.ini" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/custom/conf/app.ini"
ynh_replace_string "__KEY__" "$key" "$final_path/custom/conf/app.ini" ynh_replace_string "__KEY__" "$key" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DATA_PATH__" "$DATA_PATH" "$final_path/custom/conf/app.ini" ynh_replace_string "__DATA_PATH__" "$DATA_PATH" "$final_path/custom/conf/app.ini"
@ -75,9 +75,9 @@ set_permission() {
} }
set_access_settings() { set_access_settings() {
if [ "$is_public" = '1' ] if [ $is_public -eq 1 ]
then then
ynh_app_setting_set $app unprotected_uris "/" ynh_permission_update --permission="main" --add="visitors"
else else
# For an access to the git server by https in private mode we need to allow the access to theses URL : # For an access to the git server by https in private mode we need to allow the access to theses URL :
# - "DOMAIN/PATH/USER/REPOSITORY/info/refs" # - "DOMAIN/PATH/USER/REPOSITORY/info/refs"

View file

@ -203,11 +203,13 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1 ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary or protect it set_access_settings
if [ $is_public -eq 1 ]
then # # Make app public if necessary or protect it
ynh_permission_update --permission="main" --add="visitors" # if [ $is_public -eq 1 ]
fi # then
# ynh_permission_update --permission="main" --add="visitors"
# fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -34,6 +34,18 @@ architecture=$(ynh_detect_arch)
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================