pass into .env

This commit is contained in:
Cayo Puigdefabregas 2021-07-05 15:04:14 +02:00
parent 2cd4fa84c1
commit 25482125a3
2 changed files with 4 additions and 4 deletions

View file

@ -76,3 +76,4 @@ class DevicehubConfig(Config):
"""Definition of path where save the documents of customers""" """Definition of path where save the documents of customers"""
PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/') PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/')
JWT_PASS = config('JWT_PASS', '')

View file

@ -1,5 +1,7 @@
""" This is the view for Snapshots """ """ This is the view for Snapshots """
import jwt
import ereuse_utils
from datetime import timedelta from datetime import timedelta
from distutils.version import StrictVersion from distutils.version import StrictVersion
from uuid import UUID from uuid import UUID
@ -167,12 +169,9 @@ class LiveView(View):
return live return live
import jwt
import ereuse_utils
def decode_snapshot(data): def decode_snapshot(data):
p = '7KU4ZzsEfe'
try: try:
return jwt.decode(data['data'], p, algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder) return jwt.decode(data['data'], app.config['JWT_PASS'], algorithms="HS256", json_encoder=ereuse_utils.JSONEncoder)
except jwt.exceptions.InvalidSignatureError as err: except jwt.exceptions.InvalidSignatureError as err:
txt = 'Invalid snapshot' txt = 'Invalid snapshot'
raise ValidationError(txt) raise ValidationError(txt)