mirror of
https://github.com/YunoHost-Apps/dont-code_ynh.git
synced 2024-09-03 18:26:34 +02:00
db_password issue
This commit is contained in:
parent
70f623709d
commit
db2dc42863
2 changed files with 9 additions and 9 deletions
|
@ -46,6 +46,11 @@ 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
|
||||
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}"
|
||||
|
||||
ynh_add_config --template=".env" --destination="$install_dir/.env"
|
||||
|
||||
chmod 400 "$install_dir/.env"
|
||||
|
@ -85,11 +90,6 @@ 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"
|
||||
|
||||
# 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
|
||||
ynh_mongo_setup_db --db_user="$db_user" --db_pwd="$db_pwd" --db_name="dontCode$tenant${db_name}"
|
||||
done
|
||||
|
|
|
@ -40,6 +40,10 @@ if [ -z "${tenant+x}" ]; then
|
|||
ynh_app_setting_set --app="$app" --key=tenant --value="$tenant"
|
||||
fi
|
||||
|
||||
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}"
|
||||
|
||||
if [[ -n "${document_path:-}" ]]; then
|
||||
# Renamed setting key
|
||||
document_dir="$document_path"
|
||||
|
@ -133,10 +137,6 @@ ynh_script_progression --message="Upgrading MongoDB..." --weight=1
|
|||
# Install the required version of Mongo
|
||||
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
|
||||
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}"
|
||||
|
|
Loading…
Reference in a new issue