1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/writefreely_ynh.git synced 2024-09-03 20:36:02 +02:00

ynh_add_config

This commit is contained in:
yalh76 2021-02-26 01:12:35 +01:00
parent a9189c577d
commit 299ff97b62
3 changed files with 12 additions and 29 deletions

View file

@ -14,16 +14,16 @@ hash_seed =
[database]
type = mysql
filename =
username = __DBUSER__
password = __DBPWD__
database = __DBNAME__
username = __DB_USER__
password = __DB_PWD__
database = __DB_NAME__
host = localhost
port = 3306
[app]
site_name = WriteFreely
site_description = WriteFreely_Blogs
host = __DOMAIN_URL__
host = https://__DOMAIN____PATH_URL__
theme = write
editor =
disable_js = false
@ -34,7 +34,7 @@ wf_modesty = false
chorus = false
forest = false
disable_drafts = false
single_user = __SINGLEUSER__
single_user = __SINGLE_USER__
open_registration = true
min_username_len = 3
max_blogs = 4

View file

@ -129,23 +129,7 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Modifying a config file..."
# setup application config
cp "../conf/config.ini" "$final_path/config.ini"
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$final_path/config.ini"
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$final_path/config.ini"
ynh_replace_string --match_string="__DBPWD__" --replace_string="$db_pwd" --target_file="$final_path/config.ini"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.ini"
ynh_replace_string --match_string="__DOMAIN_URL__" --replace_string="https://$domain" --target_file="$final_path/config.ini"
ynh_replace_string --match_string="__SINGLEUSER__" --replace_string="$single_user" --target_file="$final_path/config.ini"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
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="$final_path/config.ini"
ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini"
#=================================================
# MAKE SETUP

View file

@ -24,7 +24,10 @@ admin=$(ynh_app_setting_get --app=$app --key=admin)
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)
port=$(ynh_app_setting_get --app=$app --key=port)
single_user=$(ynh_app_setting_get --app=$app --key=single_user)
architecture=$(ynh_detect_arch)
@ -52,7 +55,6 @@ ynh_app_setting_delete --app=$app --key=private
ynh_app_setting_delete --app=$app --key=local_timeline
# Close a port
if yunohost firewall list | grep -q "\- $port$"
then
echo "Close port $port" >&2
@ -142,14 +144,11 @@ ynh_script_progression --message="Upgrading systemd configuration..."
ynh_add_systemd_config
#=================================================
# STORE THE CONFIG FILE CHECKSUM
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
ynh_script_progression --message="Modifying a config file..."
ynh_backup_if_checksum_is_different --file="$final_path/config.ini"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/config.ini"
ynh_add_config --template="../conf/config.ini" --destination="$final_path/config.ini"
#=================================================
# GENERIC FINALIZATION