Commit 61e5446d authored by Mikaël Salson's avatar Mikaël Salson
Browse files

server: Customize subject depending on server.

This will allow filtering depending on the server that sends emails
parent 991ae401
Pipeline #139425 passed with stages
in 12 minutes and 35 seconds
......@@ -406,6 +406,7 @@ deploy_review_server:
- cp ./docker/vidjil-client/conf/conf.js ./browser/js/conf.js
- sed -i -r "s/localhost/${CI_BUILD_REF_SLUG}.server.ci.vidjil.org/g" ./browser/js/conf.js
- sed -r 's/^.*FILE_SOURCE.*$/FILE_SOURCE="\/usr\/share\/vidjil\/demo"/' ./docker/vidjil-server/conf/defs.py > ./server/web2py/applications/vidjil/modules/defs.py
- sed -i -e "/EMAIL_SUBJECT_START/c EMAIL_SUBJECT_START='[Vidjil/CI][$CI_COMMIT_REF_NAME]'" -e '/FROM_EMAIL/c FROM_EMAIL="server.ci@vidjil.org"' ./server/web2py/applications/vidjil/modules/defs.py
- mv docker docker_${CI_BUILD_REF_SLUG}
- cd docker_${CI_BUILD_REF_SLUG}
- TMP_DOCKER=$(tempfile)
......
......@@ -9,6 +9,7 @@ SMTP_CREDENTIALS = 'vidjil:smtp_pass' # set to None if no auth required
# SMTP_SERVER = 'logging' # no mail
FROM_EMAIL = 'notifications@vidjil.org'
ADMIN_EMAILS = ['notifications@vidjil.org']
EMAIL_SUBJECT_START = '[Vidjil]' # Customize the start of the email subject
### address for the sql database
### sqlite (not recommended)
......
......@@ -108,7 +108,7 @@ def run_request():
enough_space = vidjil_utils.check_enough_space(defs.DIR_RESULTS)
if not enough_space:
mail.send(to=defs.ADMIN_EMAILS,
subject="[Vidjil] Server space",
subject=defs.EMAIL_SUBJECT_START+" Server space",
message="The space in directory %s has passed below %d%%." % (defs.DIR_RESULTS, defs.FS_LOCK_THRESHHOLD))
return error_message("Runs are temporarily disabled. System admins have been made aware of the situation.")
......@@ -586,7 +586,7 @@ def error():
user_str = user_str.replace('<','').replace('>','').strip()
mail.send(to=defs.ADMIN_EMAILS,
subject="[Vidjil] Server error - %s" % user_str,
subject=defs.EMAIL_SUBJECT_START+" Server error - %s" % user_str,
message="<html>Ticket: %s<br/>At: %s<br />User: %s</html>" % (ticket_url, requested_uri, user_str))
return "Server error"
......
......@@ -144,7 +144,7 @@ def form():
enough_space = vidjil_utils.check_enough_space(defs.DIR_SEQUENCES)
if not enough_space:
mail.send(to=defs.ADMIN_EMAILS,
subject="[Vidjil] Server space",
subject=defs.EMAIL_SUBJECT_START+" Server space",
message="The space in directory %s has passed below %d%%." % (defs.DIR_SEQUENCES, defs.FS_LOCK_THRESHHOLD))
return error_message("Uploads are temporarily disabled. System admins have been made aware of the situation.")
......
......@@ -534,7 +534,7 @@ def submit():
if (p['id'] % 100) == 0:
mail.send(to=defs.ADMIN_EMAILS,
subject="[Vidjil] %d" % p['id'],
subject=defs.EMAIL_SUBJECT_START+" %d" % p['id'],
message="The %dth %s has just been created." % (p['id'], set_type))
else :
......
......@@ -9,6 +9,7 @@ SMTP_CREDENTIALS = 'vidjil:XXXXXX' # set to None if no auth required
# SMTP_SERVER = 'logging' # no mail
FROM_EMAIL = 'root@vidjil.org'
ADMIN_EMAILS = ['notifications@vidjil.org']
EMAIL_SUBJECT_START = '[Vidjil]' # Customize the start of the email subject
### Specific accounts
LIMITED_ACCOUNTS = [ ]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment