mirror of
https://github.com/YunoHost-Apps/adminer_ynh.git
synced 2024-09-03 18:06:06 +02:00
[Add] App visible to a unique user.
This commit is contained in:
parent
57667bad72
commit
293983e33a
5 changed files with 29 additions and 3 deletions
|
@ -3,7 +3,6 @@ location YNH_WWW_PATH {
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
client_max_body_size 10G;
|
|
||||||
index index.php;
|
index index.php;
|
||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
|
@ -11,7 +10,10 @@ location YNH_WWW_PATH {
|
||||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
},
|
},
|
||||||
"example": "/adminer",
|
"example": "/adminer",
|
||||||
"default": "/adminer"
|
"default": "/adminer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose the only allowed admin user",
|
||||||
|
"fr": "Choisissez l'unique utilisateur autorisé"
|
||||||
|
},
|
||||||
|
"example": "johndoe"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
12
scripts/install
Executable file → Normal file
12
scripts/install
Executable file → Normal file
|
@ -3,6 +3,7 @@
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
admin=$3
|
||||||
|
|
||||||
app_name="adminer"
|
app_name="adminer"
|
||||||
|
|
||||||
|
@ -12,11 +13,22 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Copy files to the right place
|
||||||
final_path=/var/www/$app_name
|
final_path=/var/www/$app_name
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo cp -r ../sources/* $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
|
# Files owned by root, www-data can just read
|
||||||
sudo find $final_path -type f | xargs sudo chmod 644
|
sudo find $final_path -type f | xargs sudo chmod 644
|
||||||
sudo find $final_path -type d | xargs sudo chmod 755
|
sudo find $final_path -type d | xargs sudo chmod 755
|
||||||
|
|
0
scripts/remove
Executable file → Normal file
0
scripts/remove
Executable file → Normal file
|
@ -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 find $final_path -type d | xargs sudo chmod 755
|
||||||
sudo chown -R root: $final_path
|
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
|
# 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_PATH@$path@g" ../conf/nginx.conf
|
||||||
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||||
|
|
Loading…
Reference in a new issue