diff --git a/conf/nginx.conf b/conf/nginx.conf index 6a35c2b..815df7a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,7 +3,6 @@ location YNH_WWW_PATH { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - client_max_body_size 10G; index index.php; try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { @@ -11,7 +10,10 @@ location YNH_WWW_PATH { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/manifest.json b/manifest.json index 1c2962e..05f4b53 100644 --- a/manifest.json +++ b/manifest.json @@ -29,6 +29,14 @@ }, "example": "/adminer", "default": "/adminer" + }, + { + "name": "admin", + "ask": { + "en": "Choose the only allowed admin user", + "fr": "Choisissez l'unique utilisateur autorisé" + }, + "example": "johndoe" } ] } diff --git a/scripts/install b/scripts/install old mode 100755 new mode 100644 index 3858972..5b95e24 --- a/scripts/install +++ b/scripts/install @@ -3,6 +3,7 @@ # Retrieve arguments domain=$1 path=$2 +admin=$3 app_name="adminer" @@ -12,11 +13,22 @@ if [[ ! $? -eq 0 ]]; then exit 1 fi +# Check that admin user is an existing account +sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" +if [[ ! $? -eq 0 ]]; then + echo "Error : the chosen admin user does not exist" + exit 1 +fi + # Copy files to the right place final_path=/var/www/$app_name sudo mkdir -p $final_path sudo cp -r ../sources/* $final_path +# Configuration +sudo yunohost add addaccess adminer -u $admin +sudo yunohost add setting adminer admin -v $admin + # Files owned by root, www-data can just read sudo find $final_path -type f | xargs sudo chmod 644 sudo find $final_path -type d | xargs sudo chmod 755 diff --git a/scripts/remove b/scripts/remove old mode 100755 new mode 100644 diff --git a/scripts/upgrade b/scripts/upgrade index 35b5857..82d6d0a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,10 @@ sudo find $final_path -type f | xargs sudo chmod 644 sudo find $final_path -type d | xargs sudo chmod 755 sudo chown -R root: $final_path +# Configuration +sudo yunohost app addaccess phpmyadmin -u $admin +sudo yunohost app setting phpmyadmin admin -v $admin + # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf