Commit a88d5ec7 authored by Elia Ponzio's avatar Elia Ponzio
Browse files

Merge branch 'dev' of git.vshn.net:elia.ponzio/generic-monitoring into dev

parents e3ab8f26 38608663
......@@ -29,7 +29,7 @@ A ORM will help us, TBD.
* create database: `CREATE DATABASE cynomys;`
* grant user access to db: `GRANT ALL ON cynomys TO cynomys;`
Use cockroachdb as django backend: `DJANGO_DATABASE='cockroach-insecure' ./manage.py xxx`
Use cockroachdb as django backend: `CYNOMYS_DATABASE='cockroach-insecure' ./manage.py xxx`
## Install
......@@ -50,6 +50,7 @@ deactivate
## Run
```
export CYNOMYS_EMAIL_PASSWORD=<SUPER_SECRET>
./manage.py migrate
./manage.py createsuperuser
./manage.py runserver
......
import os
from celery import Celery
from django.core.mail import send_mail
import subprocess
......@@ -38,8 +39,15 @@ def l4_check():
pass
@app.task()
def notify_email():
pass
def notify_email(checkTask, receiver):
print("Sending email from task " + checkTask + " to " + receiver)
send_mail(
"Status Change",
"Message which task etc.",
None,
[receiver],
fail_silently=False
)
@app.task()
def notify_webhook():
......
......@@ -100,7 +100,7 @@ DATABASES = {
}
}
default_database = environ.get('DJANGO_DATABASE', 'sqlite')
default_database = environ.get('CYNOMYS_DATABASE', 'sqlite')
DATABASES['default'] = DATABASES[default_database]
# Password validation
......@@ -149,3 +149,16 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Celery settings
CELERY_BROKER_URL = "redis://127.0.0.1:6379/0"
CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/0"
# Email settings
# https://docs.djangoproject.com/en/3.2/ref/settings/#email-backend
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = "cynomys.vshn@gmail.com"
EMAIL_HOST_PASSWORD = environ.get('CYNOMYS_EMAIL_PASSWORD', 'sqlite')
EMAIL_PORT = 587
EMAIL_SUBJECT_PREFIX = "[cynomys] "
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
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