1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git synced 2024-09-03 18:36:09 +02:00

Remove password from log

This commit is contained in:
Maniack Crudelis 2017-12-21 20:44:05 +01:00
parent f17b3f33cd
commit 011503a5b3
4 changed files with 29 additions and 6 deletions

View file

@ -343,6 +343,23 @@ ynh_exec_fully_quiet () {
eval $@ > /dev/null 2>&1
}
# Remove any logs for all the following commands.
#
# usage: ynh_print_OFF
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
ynh_print_OFF () {
set +x
}
# Restore the logging after ynh_print_OFF
#
# usage: ynh_print_ON
ynh_print_ON () {
set -x
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
echo ynh_print_ON > /dev/null
}
#=================================================
# Install or update the main directory yunohost.multimedia

View file

@ -29,7 +29,7 @@ ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est dét
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
ynh_print_OFF; password=$YNH_APP_ARG_PASSWORD; ynh_print_ON
language=$YNH_APP_ARG_LANGUAGE
is_public=$YNH_APP_ARG_IS_PUBLIC
export=$YNH_APP_ARG_EXPORT
@ -41,10 +41,12 @@ app=$YNH_APP_INSTANCE_NAME
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
ynh_print_OFF
if [ "${#password}" -lt 8 ] || [ "${#password}" -gt 30 ]
then
ynh_die "The password must be between 8 and 30 characters."
fi
ynh_print_ON
if [ "$path_url" != "/" ] && [ $mypads -eq 1 ]
then
@ -70,7 +72,7 @@ ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app password $password
ynh_print_OFF; ynh_app_setting_set $app password $password; ynh_print_ON
ynh_app_setting_set $app language $language
ynh_app_setting_set $app export $export
ynh_app_setting_set $app mypads $mypads
@ -167,7 +169,7 @@ ynh_replace_string "__PORT__" "$port" "$final_path/settings.json"
ynh_replace_string "__DB_USER__" "$db_name" "$final_path/credentials.json"
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
ynh_replace_password_string "__PASSWD__" "$password" "$final_path/credentials.json"
ynh_print_OFF; ynh_replace_password_string "__PASSWD__" "$password" "$final_path/credentials.json"; ynh_print_ON
if [ "$export" = "abiword" ]
then
abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword
@ -297,6 +299,7 @@ else
Informations2=""
fi
ynh_print_OFF
message="$Informations1
Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
@ -307,3 +310,4 @@ $Informations2
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh"
ynh_send_readme_to_admin "$message" "$admin"
ynh_print_ON

View file

@ -40,7 +40,7 @@ db_name=$(ynh_app_setting_get $app db_name)
export=$(ynh_app_setting_get $app export)
mypads=$(ynh_app_setting_get $app mypads)
admin=$(ynh_app_setting_get $app admin)
password=$(ynh_app_setting_get $app password)
ynh_print_OFF; password=$(ynh_app_setting_get $app password); ynh_print_ON
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -164,6 +164,7 @@ else
Informations2=""
fi
ynh_print_OFF
message="$Informations1
Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
@ -174,3 +175,4 @@ $Informations2
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh"
ynh_send_readme_to_admin "$message" "$admin"
ynh_print_ON

View file

@ -155,10 +155,10 @@ cp ../conf/credentials.json "$final_path/credentials.json"
ynh_replace_string "__PORT__" "$port" "$final_path/settings.json"
ynh_replace_string "__DB_USER__" "$app" "$final_path/credentials.json"
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
password=$(ynh_app_setting_get $app password)
ynh_print_OFF; password=$(ynh_app_setting_get $app password); ynh_print_ON
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
ynh_replace_password_string "__PASSWD__" "$password" "$final_path/credentials.json"
ynh_print_OFF; ynh_replace_password_string "__PASSWD__" "$password" "$final_path/credentials.json"; ynh_print_ON
if [ "$export" = "abiword" ]
then
abiword_path=`which abiword` # Récupère l'emplacement de l'exécutable de abiword