mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Add SMTP configuration
This commit is contained in:
parent
27b5edf718
commit
bf9dbbb01b
5 changed files with 34 additions and 6 deletions
|
@ -554,6 +554,13 @@ EMAIL_SEND_HTML = True
|
|||
# Subject of emails includes site title
|
||||
EMAIL_SUBJECT_PREFIX = '[{0}] '.format(SITE_TITLE)
|
||||
|
||||
# SMTP settings
|
||||
EMAIL_HOST="localhost"
|
||||
EMAIL_HOST_USER="__NAME__"
|
||||
EMAIL_HOST_PASSWORD="__SMTPPWD__"
|
||||
EMAIL_PORT=465
|
||||
EMAIL_USE_SSL=True
|
||||
|
||||
# Enable remote hooks
|
||||
ENABLE_HOOKS = True
|
||||
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
#!/bin/bash
|
||||
# Source: https://github.com/YunoHost-Apps/coin_ynh/
|
||||
|
||||
# Create a system user
|
||||
#
|
||||
# usage: ynh_system_user_create user_name [home_dir]
|
||||
# | arg: user_name - Name of the system user that will be create
|
||||
# | arg: home_dir - Path of the home dir for the user. Usually the final path of the app. If this argument is omitted, the user will be created without home
|
||||
# | arg: password - user password (for SMTP access)
|
||||
ynh_system_user_create_smtp () {
|
||||
if ! ynh_system_user_exists "$1" # Check if the user exists on the system
|
||||
then # If the user doesn't exist
|
||||
if [ $# -ge 2 ]; then # If a home dir is mentioned
|
||||
user_home_dir="-d $2"
|
||||
else
|
||||
user_home_dir="--no-create-home"
|
||||
fi
|
||||
user_home_dir="-d $2"
|
||||
sudo useradd $user_home_dir --system --user-group $1 --shell /bin/false || ynh_die "Unable to create $1 system account"
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_psql_test_if_first_run() {
|
||||
if [ -f /etc/yunohost/psql ];
|
||||
|
|
|
@ -101,8 +101,10 @@ ynh_add_nginx_config
|
|||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create "$app"
|
||||
# Create system user for email notifications
|
||||
smtp_pwd=$(ynh_string_random)
|
||||
ynh_system_user_create_smtp "$app" "$smtp_pwd"
|
||||
ynh_app_setting_set "$app" smtppwd "$smtp_pwd"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -156,7 +158,7 @@ ynh_replace_string "__DOMAIN__" "$domain" "$final_path/venv/lib/python2.7
|
|||
ynh_replace_string "__KEY__" "$key" "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||
ynh_replace_string "__PATHURL__" "$path_url" "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||
|
||||
ynh_replace_string "__SMTPPWD__" "$smtp_pwd" "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP Filling up the database
|
||||
|
|
|
@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
path_url=$(ynh_app_setting_get $app path)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
db_name=$(ynh_app_setting_get $app db_name)
|
||||
smtp_pwd=$(ynh_app_setting_get $app smtppwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -60,7 +61,7 @@ ynh_restore_file "$final_path"
|
|||
#=================================================
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create "$app"
|
||||
ynh_system_user_create_smtp "$app" "$smtp_pwd"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
|
|
|
@ -22,6 +22,7 @@ is_public=$(ynh_app_setting_get $app is_public)
|
|||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
port=$(ynh_app_setting_get $app port)
|
||||
db_name=$(ynh_app_setting_get $app db_name)
|
||||
smtp_pwd=$(ynh_app_setting_get $app smtppwd)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -68,7 +69,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
ynh_system_user_create_smtp "$app" "$smtp_pwd"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
|
Loading…
Reference in a new issue