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

Conditional config_file upgrade

avoids a warning if the file has not been generated
This commit is contained in:
tituspijean 2024-03-16 13:55:53 +01:00 committed by GitHub
parent e737a468d5
commit 288d064589
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -48,10 +48,12 @@ chown $app:$app "$install_dir/live/.env"
# Fix SMTP configuration # Fix SMTP configuration
config_file=$data_dir/config.json config_file=$data_dir/config.json
cat <<< $(jq -r --arg domain "$domain" '.smtp_host = $domain' $config_file) > $config_file if [ -e "$config_file" ]; then
cat <<< $(jq -r '.smtp_security = "starttls"' $config_file) > $config_file cat <<< $(jq -r --arg domain "$domain" '.smtp_host = $domain' $config_file) > $config_file
if [ ! -s "$config_file" ]; then cat <<< $(jq -r '.smtp_security = "starttls"' $config_file) > $config_file
ynh_die --message="Something went wrong while setting up the configuration file: it ended up empty." if [ ! -s "$config_file" ]; then
ynh_die --message="Something went wrong while setting up $config_file: it ended up empty."
fi
fi fi
#================================================= #=================================================