aboutsummaryrefslogtreecommitdiff
path: root/scripts/install
diff options
context:
space:
mode:
authoryalh76 <yalh@yahoo.com>2019-03-21 04:30:44 +0100
committeryalh76 <yalh@yahoo.com>2019-03-21 04:30:44 +0100
commit4325834c7af35fc15d65e00e5ca6033ab94452dc (patch)
treeb404e0a4d8107fe22c53a4a7a334c107efe2f8bf /scripts/install
parent9d671c8fc123d336165236f0c966fd88192cfe8e (diff)
downloadmastodon_ynh-4325834c7af35fc15d65e00e5ca6033ab94452dc.tar.gz
mastodon_ynh-4325834c7af35fc15d65e00e5ca6033ab94452dc.tar.bz2
mastodon_ynh-4325834c7af35fc15d65e00e5ca6033ab94452dc.zip
provide a .env.production file
Diffstat (limited to 'scripts/install')
-rw-r--r--scripts/install27
1 files changed, 10 insertions, 17 deletions
diff --git a/scripts/install b/scripts/install
index 4580915..7ef69cc 100644
--- a/scripts/install
+++ b/scripts/install
@@ -167,31 +167,24 @@ ynh_install_ruby --ruby_version=2.6.0
# MODIFY A CONFIG FILE
#=================================================
-cp -a $final_path/live/.env.production.sample $final_path/live/.env.production
-ynh_replace_string "REDIS_HOST=redis" "REDIS_HOST=127.0.0.1" "${final_path}/live/.env.production"
-ynh_replace_string "DB_HOST=db" "DB_HOST=/var/run/postgresql" "${final_path}/live/.env.production"
-ynh_replace_string "DB_USER=postgres" "DB_USER=${app}" "${final_path}/live/.env.production"
-ynh_replace_string "DB_NAME=postgres" "DB_NAME=${db_name}" "${final_path}/live/.env.production"
-ynh_replace_string "DB_PASS=" "DB_PASS=${db_pwd}" "${final_path}/live/.env.production"
-ynh_replace_string "LOCAL_DOMAIN=example.com" "LOCAL_DOMAIN=${domain}" "${final_path}/live/.env.production"
+cp -f ../conf/.env.production.sample "$final_path/live/.env.production"
+ynh_replace_string "__DB_USER__" "$app" "$final_path/live/.env.production"
+ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/live/.env.production"
+ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/live/.env.production"
+ynh_replace_string "__DOMAIN__" "$domain" "$final_path/live/.env.production"
language="$(echo $language | head -c 2)"
-ynh_replace_string "# DEFAULT_LOCALE=de" "DEFAULT_LOCALE=${language}" "${final_path}/live/.env.production"
+ynh_replace_string "__LANGUAGE__" "$language" "$final_path/live/.env.production"
paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
ynh_replace_string "PAPERCLIP_SECRET=" "PAPERCLIP_SECRET=$paperclip_secret" "${final_path}/live/.env.production"
-ynh_replace_string "SECRET_KEY_BASE=" "SECRET_KEY_BASE=$secret_key_base" "${final_path}/live/.env.production"
-ynh_replace_string "OTP_SECRET=" "OTP_SECRET=$otp_secret" "${final_path}/live/.env.production"
-ynh_replace_string "SMTP_LOGIN=" "#SMTP_LOGIN=" "${final_path}/live/.env.production"
-ynh_replace_string "SMTP_PASSWORD=" "#SMTP_PASSWORD=" "${final_path}/live/.env.production"
-ynh_replace_string "SMTP_SERVER=smtp.mailgun.org" "SMTP_SERVER=localhost" "${final_path}/live/.env.production"
-ynh_replace_string "SMTP_PORT=587" "SMTP_PORT=25" "${final_path}/live/.env.production"
-ynh_replace_string "SMTP_FROM_ADDRESS=notifications@example.com" "SMTP_FROM_ADDRESS=$admin_mastodon@$domain" "${final_path}/live/.env.production"
-ynh_replace_string "#SMTP_AUTH_METHOD=plain" "SMTP_AUTH_METHOD=none" "${final_path}/live/.env.production"
-ynh_replace_string "#SMTP_OPENSSL_VERIFY_MODE=peer" "SMTP_OPENSSL_VERIFY_MODE=none" "${final_path}/live/.env.production"
+ynh_replace_string "__SECRET_KEY_BASE__" "$secret_key_base" "$final_path/live/.env.production"
+ynh_replace_string "__OTP_SECRET__" "$otp_secret" "$final_path/live/.env.production"
+
+ynh_replace_string "__SMTP_FROM_ADDRESS__" "$admin_mastodon_mail" "${final_path}/live/.env.production"
#=================================================
# INSTALLING MASTODON