mirror of
https://github.com/YunoHost-Apps/kanboard_ynh.git
synced 2024-09-03 19:36:17 +02:00
use ynh_add_nginx_config, rename in
This commit is contained in:
parent
c1dab9e7fc
commit
3cc4c7ef75
4 changed files with 22 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
location PATHTOCHANGE {
|
||||
alias ALIASTOCHANGE/;
|
||||
location __PATH__ {
|
||||
alias __FINALPATH__/;
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ location PATHTOCHANGE {
|
|||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php5-fpm-NAMETOCHANGE.sock;
|
||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -11,19 +11,19 @@ ynh_abort_if_errors
|
|||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Normalize the url path syntax
|
||||
path=$(ynh_normalize_url_path "$path")
|
||||
path=$(ynh_normalize_url_path "$path_url")
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available "$domain" "$path"
|
||||
ynh_webpath_available "$domain" "$path_url"
|
||||
# Register (book) web path
|
||||
ynh_webpath_register "$app" "$domain" "$path"
|
||||
ynh_webpath_register "$app" "$domain" "$path_url"
|
||||
|
||||
ynh_app_setting_set $app admin_user $admin
|
||||
|
||||
|
@ -73,18 +73,19 @@ ynh_replace_string "#DESTDIR#" "$final_path" "$phpfpm_conf"
|
|||
chown root: $phpfpm_conf
|
||||
chmod 644 $phpfpm_conf
|
||||
|
||||
finalnginxconf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
cp ../conf/nginx.conf "$finalnginxconf"
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
ynh_replace_string "NAMETOCHANGE" "$app" "$finalnginxconf"
|
||||
ynh_replace_string "PATHTOCHANGE" "$path" "$finalnginxconf"
|
||||
ynh_replace_string "ALIASTOCHANGE" "$final_path" "$finalnginxconf"
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
if [ "$path" == "/" ]
|
||||
if [ "$path_url" == "/" ]
|
||||
then
|
||||
# ynh panel is only comptable with non-root installation
|
||||
ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"
|
||||
|
||||
ynh_store_file_checksum "$finalnginxconf"
|
||||
fi
|
||||
|
||||
# Make app public or private
|
||||
|
|
|
@ -17,12 +17,12 @@ dbuser=$app
|
|||
|
||||
# Retrieve old app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path=$(ynh_app_setting_get "$app" path)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
final_path=$(ynh_app_setting_get "$app" final_path)
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available "$domain" "$path"
|
||||
ynh_webpath_available "$domain" "$path_url"
|
||||
|
||||
# Check destination directory
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
|
|
@ -20,7 +20,7 @@ source /usr/share/yunohost/helpers
|
|||
|
||||
# Retrieve settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path=$(ynh_app_setting_get "$app" path)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
admin=$(ynh_app_setting_get "$app" adminusername)
|
||||
email=$(ynh_user_get_info "$admin" mail)
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
|
@ -80,18 +80,14 @@ ynh_replace_string "#DESTDIR#" "$final_path" "$phpfpm_conf"
|
|||
chown root: $phpfpm_conf
|
||||
chmod 644 $phpfpm_conf
|
||||
|
||||
finalnginxconf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
cp ../conf/nginx.conf "$finalnginxconf"
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
ynh_replace_string "NAMETOCHANGE" "${app}" "$finalnginxconf"
|
||||
ynh_replace_string "PATHTOCHANGE" "${path}" "$finalnginxconf"
|
||||
ynh_replace_string "ALIASTOCHANGE" "${final_path}" "$finalnginxconf"
|
||||
|
||||
if [ "$path" == "/" ]
|
||||
if [ "$path_url" == "/" ]
|
||||
then
|
||||
# ynh panel is only comptable with non-root installation
|
||||
ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"
|
||||
|
||||
ynh_store_file_checksum "$finalnginxconf"
|
||||
fi
|
||||
|
||||
# Make app public or private
|
||||
|
|
Loading…
Reference in a new issue