mirror of
https://github.com/YunoHost-Apps/question2answer_ynh.git
synced 2024-09-03 20:16:07 +02:00
[enh] Use boolean for is_public and add a language choice argument
This commit is contained in:
parent
f34527ba01
commit
e4befaebe5
3 changed files with 13 additions and 10 deletions
|
@ -50,21 +50,21 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Is it a public application?",
|
"en": "Is it a public application?",
|
||||||
"fr": "Est-ce une application publique ?"
|
"fr": "Est-ce une application publique ?"
|
||||||
},
|
},
|
||||||
"choices": ["Yes", "No"],
|
"default": true
|
||||||
"default": "Yes"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "my_boolean",
|
"name": "language",
|
||||||
"type": "boolean",
|
"ask": {
|
||||||
"ask": {
|
"en": "Choose the application language",
|
||||||
"en": "Do you want to check this boolean ?",
|
"fr": "Choisissez la langue de l'application"
|
||||||
"fr": "Tu veux cocher ce booléen ?"
|
|
||||||
},
|
},
|
||||||
"default": true
|
"choices": ["fr", "en"],
|
||||||
|
"default": "fr"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,12 @@ domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
admin=$3
|
admin=$3
|
||||||
is_public=$4
|
is_public=$4
|
||||||
|
language=$5
|
||||||
|
|
||||||
# Save app settings
|
# Save app settings
|
||||||
sudo yunohost app setting $app admin -v "$admin"
|
sudo yunohost app setting $app admin -v "$admin"
|
||||||
sudo yunohost app setting $app is_public -v "$is_public"
|
sudo yunohost app setting $app is_public -v "$is_public"
|
||||||
|
sudo yunohost app setting $app language -v "$language"
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a $app \
|
sudo yunohost app checkurl $domain$path -a $app \
|
||||||
|
@ -56,7 +58,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
#sudo chmod 644 $finalphpconf
|
#sudo chmod 644 $finalphpconf
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
if [ "$is_public" = "Yes" ];
|
if [[ $is_public -eq 1 ]];
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||||
|
|
|
@ -11,6 +11,7 @@ domain=$(sudo yunohost app setting $app domain)
|
||||||
path=$(sudo yunohost app setting $app path)
|
path=$(sudo yunohost app setting $app path)
|
||||||
admin=$(sudo yunohost app setting $app admin)
|
admin=$(sudo yunohost app setting $app admin)
|
||||||
is_public=$(sudo yunohost app setting $app is_public)
|
is_public=$(sudo yunohost app setting $app is_public)
|
||||||
|
language=$(sudo yunohost app setting $app language)
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Remove trailing "/" for next commands
|
||||||
path=${path%/}
|
path=${path%/}
|
||||||
|
@ -43,7 +44,7 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
#sudo chmod 644 $finalphpconf
|
#sudo chmod 644 $finalphpconf
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
if [ "$is_public" = "Yes" ];
|
if [[ $is_public -eq 1 ]];
|
||||||
then
|
then
|
||||||
# See install script
|
# See install script
|
||||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||||
|
|
Loading…
Reference in a new issue