1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00
This commit is contained in:
ericgaspar 2021-12-11 10:29:20 +01:00
parent e7dceca05b
commit 20cfd4426e
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 8 additions and 12 deletions

View file

@ -27,8 +27,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
app_key=$(ynh_string_random --length=32 | base64)
app_key="base64:$app_key"
app_key="base64:$(ynh_string_random --length=32 | base64)"
app=$YNH_APP_INSTANCE_NAME
@ -74,22 +73,17 @@ ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..."
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=32)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
# Initialize database and store postgres password for upgrade
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
#=================================================
# CONFIGURE REDIS DATABASE
#=================================================
ynh_script_progression --message="Creating a Redis database..."
# Configure redis
redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
@ -188,6 +182,8 @@ popd
ynh_script_progression --message="Installing the cron file..."
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION

View file

@ -114,7 +114,7 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..."
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name

View file

@ -22,7 +22,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
app_key=$(ynh_app_setting_get --app=$app --key=app_key)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)