mirror of
https://github.com/YunoHost-Apps/paheko_ynh.git
synced 2024-09-03 19:56:22 +02:00
add in config panel avalaibity to disable emails
This commit is contained in:
parent
2a72438e84
commit
f6d58358ef
4 changed files with 17 additions and 8 deletions
|
@ -498,7 +498,7 @@ const USE_CRON = true;
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//const DISABLE_EMAIL = false;
|
const DISABLE_EMAIL = __DISABLE_EMAIL__;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,29 +20,34 @@ name.fr = "Configuration SMTP"
|
||||||
|
|
||||||
optional = false
|
optional = false
|
||||||
|
|
||||||
|
[main.smtp.disable_email]
|
||||||
|
ask.fr = "Désactiver l'envoi des mails (non par défaut)"
|
||||||
|
type = "boolean"
|
||||||
|
bind = "DISABLE_EMAIL:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.smtp_host]
|
[main.smtp.smtp_host]
|
||||||
ask = "Host"
|
ask.fr = "Serveur SMTP"
|
||||||
type = "string"
|
type = "string"
|
||||||
bind = "SMTP_HOST:__INSTALL_DIR__/config.local.php"
|
bind = "SMTP_HOST:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.smtp_port]
|
[main.smtp.smtp_port]
|
||||||
ask = "Port"
|
ask.fr = "Port"
|
||||||
min = 25
|
min = 25
|
||||||
type = "number"
|
type = "number"
|
||||||
bind = "SMTP_PORT:__INSTALL_DIR__/config.local.php"
|
bind = "SMTP_PORT:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.smtp_user]
|
[main.smtp.smtp_user]
|
||||||
ask = "User"
|
ask.fr = "Nom d'utilisateur"
|
||||||
type = "string"
|
type = "string"
|
||||||
bind = "SMTP_USER:__INSTALL_DIR__/config.local.php"
|
bind = "SMTP_USER:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.smtp_password]
|
[main.smtp.smtp_password]
|
||||||
ask = "Password"
|
ask.fr = "Mot de passe"
|
||||||
type = "password"
|
type = "password"
|
||||||
bind = "SMTP_PASSWORD:__INSTALL_DIR__/config.local.php"
|
bind = "SMTP_PASSWORD:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.smtp_security]
|
[main.smtp.smtp_security]
|
||||||
ask = "Security"
|
ask.fr = "Sécurité de la connexion"
|
||||||
type = "string"
|
type = "string"
|
||||||
choices.NONE = "NONE, pas de chiffrement"
|
choices.NONE = "NONE, pas de chiffrement"
|
||||||
choices.SSL = "SSL, connexion SSL native"
|
choices.SSL = "SSL, connexion SSL native"
|
||||||
|
@ -51,11 +56,11 @@ name.fr = "Configuration SMTP"
|
||||||
bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php"
|
bind = "SMTP_SECURITY:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.mail_return_path]
|
[main.smtp.mail_return_path]
|
||||||
ask = "Adresse e-mail destinée à recevoir les erreurs de mail"
|
ask.fr = "Adresse e-mail destinée à recevoir les erreurs de mail"
|
||||||
type = "string"
|
type = "string"
|
||||||
bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php"
|
bind = "MAIL_RETURN_PATH:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
||||||
[main.smtp.mail_sender]
|
[main.smtp.mail_sender]
|
||||||
ask = "Adresse e-mail expéditrice des messages"
|
ask.fr = "Adresse e-mail expéditrice des messages"
|
||||||
type = "string"
|
type = "string"
|
||||||
bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php"
|
bind = "MAIL_SENDER:__INSTALL_DIR__/config.local.php"
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
secret_key=$(ynh_string_random --length=50)
|
secret_key=$(ynh_string_random --length=50)
|
||||||
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=smtp_disable_email --value=0
|
||||||
ynh_app_setting_set --app=$app --key=smtp_host --value=$domain
|
ynh_app_setting_set --app=$app --key=smtp_host --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=smtp_port --value=25
|
ynh_app_setting_set --app=$app --key=smtp_port --value=25
|
||||||
ynh_app_setting_set --app=$app --key=smtp_user --value=$app
|
ynh_app_setting_set --app=$app --key=smtp_user --value=$app
|
||||||
|
|
|
@ -32,6 +32,7 @@ fi
|
||||||
if [ -z "${smtp_host:-}" ]; then
|
if [ -z "${smtp_host:-}" ]; then
|
||||||
user_conf="$data_dir/data/config.local.user.php"
|
user_conf="$data_dir/data/config.local.user.php"
|
||||||
if [ -f $user_conf ]; then
|
if [ -f $user_conf ]; then
|
||||||
|
disable_email=$(ynh_read_var_in_file --file=$user_conf --key=DISABLE_EMAIL)
|
||||||
smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST)
|
smtp_host=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_HOST)
|
||||||
smtp_port=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PORT)
|
smtp_port=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_PORT)
|
||||||
smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER)
|
smtp_user=$(ynh_read_var_in_file --file=$user_conf --key=SMTP_USER)
|
||||||
|
@ -42,6 +43,7 @@ if [ -z "${smtp_host:-}" ]; then
|
||||||
ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf
|
ynh_replace_string --match_string="const SMTP_" --replace_string="//const SMTP_" --target_file=$user_conf
|
||||||
ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf
|
ynh_replace_string --match_string="const MAIL_" --replace_string="//const MAIL_" --target_file=$user_conf
|
||||||
else
|
else
|
||||||
|
disable_email=0
|
||||||
smtp_host=$domain
|
smtp_host=$domain
|
||||||
smtp_port=25
|
smtp_port=25
|
||||||
smtp_user=$app
|
smtp_user=$app
|
||||||
|
@ -50,6 +52,7 @@ if [ -z "${smtp_host:-}" ]; then
|
||||||
mail_return_path=$app@$domain
|
mail_return_path=$app@$domain
|
||||||
mail_sender=$app@$domain
|
mail_sender=$app@$domain
|
||||||
fi
|
fi
|
||||||
|
ynh_app_setting_set --app=$app --key=disable_email --value=$disable_email
|
||||||
ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host
|
ynh_app_setting_set --app=$app --key=smtp_host --value=$smtp_host
|
||||||
ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port
|
ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port
|
||||||
ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user
|
ynh_app_setting_set --app=$app --key=smtp_user --value=$smtp_user
|
||||||
|
|
Loading…
Add table
Reference in a new issue