1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wekan_ynh.git synced 2024-09-03 20:36:09 +02:00
This commit is contained in:
yalh76 2023-07-27 20:24:42 +02:00
parent 7cfef9db6a
commit 2a0a666194
2 changed files with 11 additions and 11 deletions

View file

@ -7,7 +7,7 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="" pkg_dependencies=""
nodejs_version="14.19.3" nodejs_version="14.21.3"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -10,8 +10,8 @@ YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
# example: ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("wekan")' # example: ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("wekan")'
# example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")" # example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")"
# #
# usage: ynh_mongo_exec [--user=user] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval] # usage: ynh_mongo_exec [--username=username] [--password=password] [--authenticationdatabase=authenticationdatabase] [--database=database] [--host=host] [--port=port] --command="command" [--eval]
# | arg: -u, --user= - The user name to connect as # | arg: -u, --username= - The user name to connect as
# | arg: -p, --password= - The user password # | arg: -p, --password= - The user password
# | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to # | arg: -d, --authenticationdatabase= - The authenticationdatabase to connect to
# | arg: -d, --database= - The database to connect to # | arg: -d, --database= - The database to connect to
@ -24,8 +24,8 @@ YNH_MONGO_VERSION=${YNH_MONGO_VERSION:-$YNH_DEFAULT_MONGO_VERSION}
ynh_mongo_exec() { ynh_mongo_exec() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=upadhPce local legacy_args=upadhPce
local -A args_array=( [u]=user= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval ) local -A args_array=( [u]=username= [p]=password= [a]=authenticationdatabase= [d]=database= [h]=host= [P]=port= [c]=command= [e]=eval )
local user local username
local password local password
local authenticationdatabase local authenticationdatabase
local database local database
@ -35,7 +35,7 @@ ynh_mongo_exec() {
local eval local eval
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
user="${user:-}" username="${username:-}"
password="${password:-}" password="${password:-}"
authenticationdatabase="${authenticationdatabase:-}" authenticationdatabase="${authenticationdatabase:-}"
database="${database:-}" database="${database:-}"
@ -43,10 +43,10 @@ ynh_mongo_exec() {
port="${port:-}" port="${port:-}"
eval=${eval:-0} eval=${eval:-0}
# If user is provided # If username is provided
if [ -n "$user" ] if [ -n "$username" ]
then then
user="--username=$user" username="--username=$username"
# If password is provided # If password is provided
if [ -n "$password" ] if [ -n "$password" ]
@ -89,7 +89,7 @@ ynh_mongo_exec() {
database="" database=""
fi fi
mongosh --quiet --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port <<EOF mongosh --quiet $username $password $authenticationdatabase $host $port <<EOF
$database $database
${command} ${command}
quit() quit()
@ -103,7 +103,7 @@ EOF
database="" database=""
fi fi
mongosh --quiet $database --username $user --password $password --authenticationDatabase $authenticationdatabase --host $host --port $port --eval="$command" mongosh --quiet $database $username $password $authenticationdatabase $host $port --eval="$command"
fi fi
} }