1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dont-code_ynh.git synced 2024-09-03 18:26:34 +02:00

db_user is needed as well

This commit is contained in:
Gérard Collin 2024-04-01 15:03:51 +02:00
parent 29526f4d0c
commit de87924afb
2 changed files with 5 additions and 6 deletions

View file

@ -46,11 +46,13 @@ chown -R $app:www-data "$data_dir"
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
# Let's create all databases needed, and assign them to the user
# The .env needs db_user and db_password
new_db_pwd=$(ynh_string_random) # Generate a random password
# If $db_pwd is not provided, use new_db_pwd instead for db_pwd
db_pwd="${db_pwd:-$new_db_pwd}"
db_user=$(ynh_sanitize_dbid --db_name="${app}")
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
ynh_add_config --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
@ -87,9 +89,6 @@ ynh_install_mongo --mongo_version=$mongo_version
#=================================================
ynh_script_progression --message="Creating the Mongo databases..." --weight=1
db_user=$(ynh_sanitize_dbid --db_name="${app}")
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
for db_name in "${MONGO_DB_LIST[@]}"; do
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
done

View file

@ -40,8 +40,8 @@ if [ -z "${tenant+x}" ]; then
ynh_app_setting_set --app="$app" --key=tenant --value="$tenant"
fi
# The .env needs db_password
new_db_pwd=$(ynh_string_random) # Generate a random password
# If $db_pwd is not provided, use new_db_pwd instead for db_pwd
db_pwd="${db_pwd:-$new_db_pwd}"
if [[ -n "${document_path:-}" ]]; then