1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/discourse_ynh.git synced 2024-09-03 18:26:18 +02:00

Implement ynh_add_config

This commit is contained in:
yalh76 2021-03-07 01:55:03 +01:00
parent 111d8899b1
commit 4454382b0c
2 changed files with 5 additions and 15 deletions

View file

@ -190,10 +190,8 @@ echo "svgo: false" > $final_path/.image_optim.yml
ynh_script_progression --message="Setting up Unicorn..." ynh_script_progression --message="Setting up Unicorn..."
# Set a secret value # Set a secret value
cp ../conf/secrets.yml "$final_path/config/secrets.yml" secret="$(ynh_string_random)"
ynh_replace_string --match_string="__SECRET__" --replace_string="$(ynh_string_random)" --target_file="$final_path/config/secrets.yml" ynh_add_config --template="../conf/secrets.yml" --destination="$final_path/config/secrets.yml"
# Calculate and store the config file checksum
ynh_store_file_checksum --file="$final_path/config/secrets.yml"
# Set permissions to app files # Set permissions to app files
chown -R $app: $final_path chown -R $app: $final_path

View file

@ -262,19 +262,11 @@ then
# Make a backup of the original config file if modified # Make a backup of the original config file if modified
ynh_backup_if_checksum_is_different "$unicorn_config_file" ynh_backup_if_checksum_is_different "$unicorn_config_file"
# Calculate and store the config file checksum # Calculate and store the config file checksum
ynh_store_file_checksum --file="$unicorn_config_file" ynh_store_file_checksum --file="$unicorn_config_file"
secret_config_file="$final_path/config/secrets.yml" secret="$(ynh_string_random)"
# Make a backup of the original config file if modified ynh_add_config --template="../conf/secrets.yml" --destination="$final_path/config/secrets.yml"
ynh_backup_if_checksum_is_different "$secret_config_file"
# Set a secret value
cp ../conf/secrets.yml "$final_path/config/secrets.yml"
ynh_replace_string --match_string="__SECRET__" --replace_string="$(ynh_string_random)" --target_file="$secret_config_file"
# Calculate and store the config file checksum
ynh_store_file_checksum --file="$secret_config_file"
# Set permissions to app files # Set permissions to app files
chown -R $app: $final_path chown -R $app: $final_path