Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oser-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamza Touizrat
oser-backend
Commits
aa9a2b3e
Commit
aa9a2b3e
authored
Jun 15, 2018
by
florimondmanca
Browse files
Options
Downloads
Patches
Plain Diff
add system check for SENDGRID_API_KEY setting
parent
8d537690
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
mails/apps.py
+1
-0
1 addition, 0 deletions
mails/apps.py
mails/checks.py
+20
-0
20 additions, 0 deletions
mails/checks.py
mails/settings.py
+0
-4
0 additions, 4 deletions
mails/settings.py
with
21 additions
and
4 deletions
mails/apps.py
+
1
−
0
View file @
aa9a2b3e
...
...
@@ -6,3 +6,4 @@ class MailsConfig(AppConfig):
def
ready
(
self
):
from
.
import
signals
# noqa
from
.
import
checks
# noqa
This diff is collapsed.
Click to expand it.
mails/checks.py
0 → 100644
+
20
−
0
View file @
aa9a2b3e
"""
Mails app system checks.
"""
from
django.conf
import
settings
from
django.core.checks
import
Warning
,
register
@register
()
def
check_sendgrid_api_key_is_set
(
app_configs
,
**
kwargs
):
errors
=
[]
if
getattr
(
settings
,
'
SENDGRID_API_KEY
'
,
None
)
is
None
:
errors
.
append
(
Warning
(
'
SENDGRID_API_KEY is not set, sending emails will fail
'
,
obj
=
settings
,
id
=
'
mails.W001
'
,
)
)
return
errors
This diff is collapsed.
Click to expand it.
mails/settings.py
+
0
−
4
View file @
aa9a2b3e
"""
Mails app settings.
"""
from
django.conf
import
settings
import
warnings
NOTIFICATIONS_ADDRESS
=
getattr
(
settings
,
'
MAILS_NOTIFICATIONS_ADDRESS
'
)
ENABLED
=
getattr
(
settings
,
'
MAILS_ENABLED
'
)
RAISE_EXCEPTIONS
=
getattr
(
settings
,
'
MAILS_RAISE_EXCEPTIONS
'
)
if
getattr
(
settings
,
'
SENDGRID_API_KEY
'
,
None
)
is
None
:
warnings
.
warn
(
'
SENDGRID_API_KEY is not set, sending emails will fail
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment