mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
Disable the need of port, add automatic attribution
This commit is contained in:
parent
7178bba198
commit
5836e86f8e
3 changed files with 19 additions and 13 deletions
|
@ -79,14 +79,6 @@
|
|||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
},
|
||||
{
|
||||
"name": "port",
|
||||
"ask": {
|
||||
"en": "Movim daemon port (internal only)",
|
||||
"fr": "Port du daemon Movim (interne uniquement)"
|
||||
},
|
||||
"default": "9537"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ admin=$YNH_APP_ARG_ADMIN
|
|||
password=$YNH_APP_ARG_PASSWORD
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
ssoenabled=$YNH_APP_ARG_SSOENABLED
|
||||
port=$YNH_APP_ARG_PORT
|
||||
timezone=$(cat /etc/timezone)
|
||||
|
||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
||||
|
@ -56,9 +55,6 @@ ynh_webpath_available $domain $path_url
|
|||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
# Check port availability
|
||||
yunohost app checkport "$port" \
|
||||
|| ynh_die "This port is already used"
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
|
@ -67,13 +63,20 @@ yunohost app checkport "$port" \
|
|||
# Save app settings
|
||||
ynh_app_setting_set "$app" admin "$admin"
|
||||
ynh_app_setting_set "$app" ssoenabled "$ssoenabled"
|
||||
ynh_app_setting_set "$app" port "$port"
|
||||
ynh_app_setting_set "$app" path "$path_url"
|
||||
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
|
||||
# Find a free port
|
||||
port=$(ynh_find_port 9537)
|
||||
# Open this port
|
||||
yunohost firewall allow --no-upnp TCP "$port" 2>&1
|
||||
ynh_app_setting_set "$app" port "$port"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
|
|
@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
final_path=$(ynh_app_setting_get "$app" final_path)
|
||||
port=$(ynh_app_setting_get "$app" port)
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
|
@ -69,6 +70,16 @@ ynh_mysql_drop_user "$db_user" || true
|
|||
|
||||
ynh_secure_remove "$final_path"
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
echo "Close port $port" >&2
|
||||
yunohost firewall disallow TCP $port 2>&1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue