0.3.13.6
This commit is contained in:
parent
d89e1bc6d4
commit
8498303006
13 changed files with 90 additions and 19 deletions
|
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## 0.3.13.6
|
||||
|
||||
- Try to load sentry by default for all environments
|
||||
|
||||
## 0.3.13.5
|
||||
|
||||
- Set response keyword argument
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ RUN pip install poetry
|
|||
WORKDIR /app
|
||||
COPY poetry.lock pyproject.toml /app/
|
||||
|
||||
RUN poetry config virtualenvs.create false && poetry install --no-interaction
|
||||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --extras sentry
|
||||
|
||||
COPY . /app/
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ python-tests:
|
|||
- pip install poetry --quiet
|
||||
- poetry config cache-dir .cache/poetry
|
||||
- poetry config virtualenvs.in-project true
|
||||
- poetry install --no-interaction --quiet
|
||||
- poetry install --no-interaction --quiet --extras sentry
|
||||
script:
|
||||
- poetry run coverage run src/manage.py test newsreader
|
||||
- poetry run coverage report
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "newsreader",
|
||||
"version": "0.3.13.5",
|
||||
"version": "0.3.13.6",
|
||||
"description": "Application for viewing RSS feeds",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "newsreader"
|
||||
version = "0.3.13.5"
|
||||
version = "0.3.13.6"
|
||||
description = "Webapplication for reading RSS feeds"
|
||||
authors = ["Sonny <sonnyba871@gmail.com>"]
|
||||
license = "GPL-3.0"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,17 @@ import os
|
|||
|
||||
from pathlib import Path
|
||||
|
||||
from .version import get_current_version
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
load_dotenv()
|
||||
|
||||
try:
|
||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
except ImportError:
|
||||
CeleryIntegration = None
|
||||
DjangoIntegration = None
|
||||
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
||||
|
|
@ -199,7 +209,7 @@ STATICFILES_FINDERS = [
|
|||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
# Project settings
|
||||
VERSION = get_current_version()
|
||||
ENVIRONMENT = "development"
|
||||
|
||||
# Reddit integration
|
||||
REDDIT_CLIENT_ID = "CLIENT_ID"
|
||||
|
|
@ -246,3 +256,13 @@ CELERY_WORKER_HIJACK_ROOT_LOGGER = False
|
|||
REGISTRATION_OPEN = True
|
||||
REGISTRATION_AUTO_LOGIN = True
|
||||
ACCOUNT_ACTIVATION_DAYS = 7
|
||||
|
||||
# Sentry
|
||||
SENTRY_CONFIG = {
|
||||
"dsn": os.environ.get("SENTRY_DSN"),
|
||||
"send_default_pii": False,
|
||||
"environment": ENVIRONMENT,
|
||||
"integrations": [DjangoIntegration(), CeleryIntegration()]
|
||||
if DjangoIntegration and CeleryIntegration
|
||||
else [],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from .base import * # isort:skip
|
||||
from .version import get_current_version
|
||||
|
||||
|
||||
SECRET_KEY = "mv4&5#+)-=abz3^&1r^nk_ca6y54--p(4n4cg%z*g&rb64j%wl"
|
||||
|
|
@ -9,11 +10,21 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
|||
|
||||
INSTALLED_APPS += ["debug_toolbar", "django_extensions"]
|
||||
|
||||
# Project settings
|
||||
VERSION = get_current_version()
|
||||
|
||||
# Third party settings
|
||||
AXES_FAILURE_LIMIT = 50
|
||||
AXES_COOLOFF_TIME = None
|
||||
|
||||
try:
|
||||
from .local import * # noqa
|
||||
|
||||
# Optionally use sentry integration
|
||||
from sentry_sdk import init as sentry_init
|
||||
|
||||
SENTRY_CONFIG.update({"release": VERSION})
|
||||
|
||||
sentry_init(**SENTRY_CONFIG)
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from .base import * # isort:skip
|
||||
from .version import get_current_version
|
||||
|
||||
|
||||
SECRET_KEY = "=q(ztyo)b6noom#a164g&s9vcj1aawa^g#ing_ir99=_zl4g&$"
|
||||
|
|
@ -30,6 +31,10 @@ CACHES = {
|
|||
},
|
||||
}
|
||||
|
||||
# Project settings
|
||||
VERSION = get_current_version()
|
||||
ENVIRONMENT = "docker"
|
||||
|
||||
# Third party settings
|
||||
# Axes
|
||||
AXES_FAILURE_LIMIT = 50
|
||||
|
|
@ -41,5 +46,12 @@ CELERY_BROKER_URL = "amqp://guest:guest@rabbitmq:5672//"
|
|||
|
||||
try:
|
||||
from .local import * # noqa
|
||||
|
||||
# Optionally use sentry integration
|
||||
from sentry_sdk import init as sentry_init
|
||||
|
||||
SENTRY_CONFIG.update({"release": VERSION, "environment": ENVIRONMENT})
|
||||
|
||||
sentry_init(**SENTRY_CONFIG)
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from .base import * # isort:skip
|
||||
from .version import get_current_version
|
||||
|
||||
|
||||
SECRET_KEY = "29%lkw+&n%^w4k#@_db2mo%*tc&xzb)x7xuq*(0$eucii%4r0c"
|
||||
|
|
@ -17,3 +18,17 @@ CACHES = {
|
|||
"LOCATION": "memcached:11211",
|
||||
},
|
||||
}
|
||||
|
||||
# Project settings
|
||||
VERSION = get_current_version()
|
||||
ENVIRONMENT = "gitlab"
|
||||
|
||||
try:
|
||||
# Optionally use sentry integration
|
||||
from sentry_sdk import init as sentry_init
|
||||
|
||||
SENTRY_CONFIG.update({"release": VERSION, "environment": ENVIRONMENT})
|
||||
|
||||
sentry_init(**SENTRY_CONFIG)
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from .version import get_current_version
|
||||
|
||||
|
||||
from .base import * # isort:skip
|
||||
|
||||
|
||||
load_dotenv()
|
||||
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ["rss.fudiggity.nl"]
|
||||
|
|
@ -58,6 +55,10 @@ EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD", "")
|
|||
EMAIL_USE_TLS = bool(os.environ.get("EMAIL_USE_TLS"))
|
||||
EMAIL_USE_SSL = bool(os.environ.get("EMAIL_USE_SSL"))
|
||||
|
||||
# Project settings
|
||||
VERSION = get_current_version(debug=False)
|
||||
ENVIRONMENT = "production"
|
||||
|
||||
# Reddit integration
|
||||
REDDIT_CLIENT_ID = os.environ.get("REDDIT_CLIENT_ID", "")
|
||||
REDDIT_CLIENT_SECRET = os.environ.get("REDDIT_CLIENT_SECRET", "")
|
||||
|
|
@ -76,14 +77,11 @@ REGISTRATION_OPEN = False
|
|||
# Optionally use sentry integration
|
||||
try:
|
||||
from sentry_sdk import init as sentry_init
|
||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
||||
sentry_init(
|
||||
dsn=os.environ.get("SENTRY_DSN"),
|
||||
integrations=[DjangoIntegration(), CeleryIntegration()],
|
||||
send_default_pii=False,
|
||||
release=VERSION,
|
||||
SENTRY_CONFIG.update(
|
||||
{"release": VERSION, "environment": ENVIRONMENT, "debug": False}
|
||||
)
|
||||
|
||||
sentry_init(**SENTRY_CONFIG)
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
0
src/newsreader/conf/sentry.py
Normal file
0
src/newsreader/conf/sentry.py
Normal file
|
|
@ -2,10 +2,19 @@ import os
|
|||
import subprocess
|
||||
|
||||
|
||||
def get_current_version():
|
||||
def get_current_version(debug=True):
|
||||
if "VERSION" in os.environ:
|
||||
return os.environ["VERSION"]
|
||||
|
||||
if debug:
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
["git", "show", "--no-patch", "--format=%H"], universal_newlines=True
|
||||
)
|
||||
return output.strip()
|
||||
except (subprocess.CalledProcessError, OSError):
|
||||
return ""
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(
|
||||
["git", "describe", "--tags"], universal_newlines=True
|
||||
|
|
|
|||
|
|
@ -242,7 +242,9 @@ class TwitterClient(PostClient):
|
|||
import sentry_sdk
|
||||
|
||||
with sentry_sdk.push_scope() as scope:
|
||||
scope.set_extra("content", e.response.content)
|
||||
scope.set_extra(
|
||||
"content", e.response.content if e.response else None
|
||||
)
|
||||
sentry_sdk.capture_message(
|
||||
"Twitter authentication credentials reset"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue