mirror of
https://github.com/YunoHost-Apps/dont-code_ynh.git
synced 2024-09-03 18:26:34 +02:00
generate db_pwd if needed
This commit is contained in:
parent
2fe6b4841e
commit
70f623709d
2 changed files with 7 additions and 1 deletions
|
@ -86,6 +86,9 @@ db_user=$(ynh_sanitize_dbid --db_name="${app}")
|
||||||
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
ynh_app_setting_set --app="$app" --key=db_user --value="$db_user"
|
||||||
|
|
||||||
# Let's create all databases needed, and assign them to the user
|
# Let's create all databases needed, and assign them to the user
|
||||||
|
local 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}"
|
||||||
|
|
||||||
for db_name in "${MONGO_DB_LIST[@]}"; do
|
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}"
|
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
|
||||||
|
|
|
@ -40,7 +40,6 @@ if [ -z "${tenant+x}" ]; then
|
||||||
ynh_app_setting_set --app="$app" --key=tenant --value="$tenant"
|
ynh_app_setting_set --app="$app" --key=tenant --value="$tenant"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ -n "${document_path:-}" ]]; then
|
if [[ -n "${document_path:-}" ]]; then
|
||||||
# Renamed setting key
|
# Renamed setting key
|
||||||
document_dir="$document_path"
|
document_dir="$document_path"
|
||||||
|
@ -134,6 +133,10 @@ ynh_script_progression --message="Upgrading MongoDB..." --weight=1
|
||||||
# Install the required version of Mongo
|
# Install the required version of Mongo
|
||||||
ynh_install_mongo --mongo_version=$mongo_version
|
ynh_install_mongo --mongo_version=$mongo_version
|
||||||
|
|
||||||
|
local 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}"
|
||||||
|
|
||||||
# We are now assigning the user to the database, so update the user's rights
|
# We are now assigning the user to the database, so update the user's rights
|
||||||
for db_name in "${MONGO_DB_LIST[@]}"; do
|
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}"
|
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
|
||||||
|
|
Loading…
Reference in a new issue