1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

ynh_add_config

This commit is contained in:
yalh76 2021-02-26 03:48:49 +01:00
parent 22225e8d0a
commit bd9836aecf
4 changed files with 10 additions and 49 deletions

View file

@ -37,8 +37,8 @@ database:
hostname: 'localhost'
port: 5432
ssl: false
suffix: '___DB_NAME__'
username: '__DB_NAME__'
suffix: '___APP__'
username: '__DB_USER__'
password: '__DB_PWD__'
pool:
max: 5
@ -203,7 +203,7 @@ cache:
admin:
# Used to generate the root user at first startup
# And to receive emails from the contact form
email: '__EMAIL__'
email: '__ADMIN_EMAIL__'
contact_form:
enabled: true

View file

@ -156,28 +156,9 @@ chown -R "$app":"$app" "$datadir"
#=================================================
ynh_script_progression --message="Modifying a config file..."
config="$final_path/config/production.yaml"
cp ../conf/production.yaml "$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$app" --target_file="$config"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="__EMAIL__" --replace_string="$admin_email" --target_file="$config"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config"
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
#Create the admin settings file
local_config="$final_path/config/local-production.json"
cp ../conf/local-production.json "$local_config"
#=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config"
ynh_store_file_checksum --file="$local_config"
ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json"
#=================================================
# BUILD YARN DEPENDENCIES
@ -266,13 +247,8 @@ popd
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/message_install"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message_install"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message_install"
ynh_replace_string --match_string="__ADMIN_PASS__" --replace_string="$admin_pass" --target_file="../conf/message_install"
ynh_replace_string --match_string="__RTMP_PORT__" --replace_string="$rtmp_port" --target_file="../conf/message_install"
ynh_send_readme_to_admin --app_message="../conf/message_install" --recipients=$admin_email --type='install'
ynh_add_config --template="../conf/message_install" --destination="../conf/msg_install"
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install'
#=================================================
# END OF SCRIPT

View file

@ -119,13 +119,8 @@ ynh_system_user_delete --username=$app
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/message_remove"
ynh_replace_string --match_string="__RTMP_PORT__" --replace_string="$rtmp_port" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message_remove" --recipients=$admin_email --type='remove'
ynh_add_config --template="../conf/message_remove" --destination="../conf/msg_remove"
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove'
#=================================================
# END OF SCRIPT

View file

@ -222,17 +222,7 @@ chown -R "$app":"$app" "$datadir"
#=================================================
ynh_script_progression --message="Modifying a config file..."
config="$final_path/config/production.yaml"
ynh_backup_if_checksum_is_different --file="$config"
cp ../conf/production.yaml "$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$app" --target_file="$config"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="__EMAIL__" --replace_string="$admin_email" --target_file="$config"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config"
ynh_store_file_checksum --file="$config"
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
local_config="$final_path/config/local-production.json"
ynh_backup_if_checksum_is_different --file="$local_config"