From 7419e559ac06f8e18f9a0645195132582bf49b61 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 5 Sep 2023 22:12:27 +0200 Subject: [PATCH] Make sure configuration is correct --- scripts/install | 9 +++++++++ scripts/upgrade | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/scripts/install b/scripts/install index bb610f4..feb96e3 100644 --- a/scripts/install +++ b/scripts/install @@ -51,6 +51,15 @@ pushd $install_dir/ghost --mail SMTP --mailuser noreply@$domain --mailpass $mail_pwd --mailhost 127.0.0.1 --mailport 25 popd +config_file=$install_dir/ghost/config.production.json +cat <<< $(jq -r '.database.connection.host = "127.0.0.1"' $config_file) > $config_file +cat <<< $(jq -r '.mail.options.host = "127.0.0.1"' $config_file) > $config_file +cat <<< $(jq -r '.mail.options.ignoreTLS = true' $config_file) > $config_file + +if [ ! -s "$config_file" ]; then + ynh_die --message="Something went wrong while setting up the configuration file: it ended up empty." +fi + #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3fdd90f..d64d26b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -125,6 +125,15 @@ pushd $install_dir/ghost --mail SMTP --mailuser noreply@$domain --mailpass $mail_pwd --mailhost 127.0.0.1 --mailport 25 popd +config_file=$install_dir/ghost/config.production.json +cat <<< $(jq -r '.database.connection.host = "127.0.0.1"' $config_file) > $config_file +cat <<< $(jq -r '.mail.options.host = "127.0.0.1"' $config_file) > $config_file +cat <<< $(jq -r '.mail.options.ignoreTLS = true' $config_file) > $config_file + +if [ ! -s "$config_file" ]; then + ynh_die --message="Something went wrong while setting up the configuration file: it ended up empty." +fi + # Cleanup cache ynh_secure_remove --file="$install_dir/.cache/yarn"