2018-04-27 17:16:43 +00:00
|
|
|
from distutils.version import StrictVersion
|
2018-07-22 20:42:49 +00:00
|
|
|
from itertools import chain
|
2018-04-27 17:16:43 +00:00
|
|
|
|
2022-04-08 09:10:03 +00:00
|
|
|
from decouple import config
|
2018-04-10 15:06:39 +00:00
|
|
|
|
2022-04-08 09:10:03 +00:00
|
|
|
from ereuse_devicehub.resources import (
|
|
|
|
action,
|
|
|
|
agent,
|
|
|
|
deliverynote,
|
|
|
|
inventory,
|
|
|
|
lot,
|
|
|
|
tag,
|
|
|
|
user,
|
|
|
|
)
|
2018-10-04 08:59:31 +00:00
|
|
|
from ereuse_devicehub.resources.device import definitions
|
2023-05-31 16:29:00 +00:00
|
|
|
from ereuse_devicehub.resources.did import did
|
2023-01-19 11:26:25 +00:00
|
|
|
from ereuse_devicehub.resources.documents import documents
|
2019-04-16 15:47:28 +00:00
|
|
|
from ereuse_devicehub.resources.enums import PriceSoftware
|
2020-12-29 16:37:13 +00:00
|
|
|
from ereuse_devicehub.resources.licences import licences
|
2020-11-23 17:03:06 +00:00
|
|
|
from ereuse_devicehub.resources.metric import definitions as metric_def
|
2022-04-08 09:10:03 +00:00
|
|
|
from ereuse_devicehub.resources.tradedocument import definitions as tradedocument
|
|
|
|
from ereuse_devicehub.resources.versions import versions
|
2023-03-21 11:08:13 +00:00
|
|
|
from ereuse_devicehub.teal.auth import TokenAuth
|
|
|
|
from ereuse_devicehub.teal.config import Config
|
|
|
|
from ereuse_devicehub.teal.enums import Currency
|
|
|
|
from ereuse_devicehub.teal.utils import import_resource
|
2018-09-07 10:38:02 +00:00
|
|
|
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
class DevicehubConfig(Config):
|
2022-04-08 09:10:03 +00:00
|
|
|
RESOURCE_DEFINITIONS = set(
|
|
|
|
chain(
|
|
|
|
import_resource(definitions),
|
|
|
|
import_resource(action),
|
|
|
|
import_resource(user),
|
|
|
|
import_resource(tag),
|
2023-05-31 16:29:00 +00:00
|
|
|
import_resource(did),
|
2022-04-08 09:10:03 +00:00
|
|
|
import_resource(agent),
|
|
|
|
import_resource(lot),
|
|
|
|
import_resource(deliverynote),
|
|
|
|
import_resource(documents),
|
|
|
|
import_resource(tradedocument),
|
|
|
|
import_resource(inventory),
|
|
|
|
import_resource(versions),
|
|
|
|
import_resource(licences),
|
|
|
|
import_resource(metric_def),
|
|
|
|
),
|
|
|
|
)
|
2022-11-24 11:21:42 +00:00
|
|
|
PASSWORD_SCHEMES = {'pbkdf2_sha256'}
|
2021-12-28 11:32:38 +00:00
|
|
|
SECRET_KEY = config('SECRET_KEY')
|
2020-09-29 07:42:05 +00:00
|
|
|
DB_USER = config('DB_USER', 'dhub')
|
|
|
|
DB_PASSWORD = config('DB_PASSWORD', 'ereuse')
|
|
|
|
DB_HOST = config('DB_HOST', 'localhost')
|
|
|
|
DB_DATABASE = config('DB_DATABASE', 'devicehub')
|
2021-03-02 16:11:34 +00:00
|
|
|
DB_SCHEMA = config('DB_SCHEMA', 'dbtest')
|
2020-09-29 07:42:05 +00:00
|
|
|
SQLALCHEMY_DATABASE_URI = 'postgresql://{user}:{pw}@{host}/{db}'.format(
|
|
|
|
user=DB_USER,
|
|
|
|
pw=DB_PASSWORD,
|
|
|
|
host=DB_HOST,
|
|
|
|
db=DB_DATABASE,
|
|
|
|
) # type: str
|
2021-05-26 09:00:43 +00:00
|
|
|
SCHEMA = config('SCHEMA', 'dbtest')
|
2022-04-08 09:10:03 +00:00
|
|
|
HOST = config('HOST', 'localhost')
|
2022-11-07 16:08:03 +00:00
|
|
|
API_HOST = config('API_HOST', 'localhost')
|
2018-07-02 10:52:54 +00:00
|
|
|
MIN_WORKBENCH = StrictVersion('11.0a1') # type: StrictVersion
|
2019-06-19 11:35:26 +00:00
|
|
|
"""The minimum version of ereuse.org workbench that this devicehub
|
2018-06-26 13:36:21 +00:00
|
|
|
accepts. we recommend not changing this value.
|
2018-05-30 10:49:40 +00:00
|
|
|
"""
|
2022-05-16 15:57:09 +00:00
|
|
|
SCHEMA_WORKBENCH = ["1.0.0"]
|
2020-10-13 13:37:21 +00:00
|
|
|
|
|
|
|
TMP_SNAPSHOTS = config('TMP_SNAPSHOTS', '/tmp/snapshots')
|
2020-12-29 16:37:13 +00:00
|
|
|
TMP_LIVES = config('TMP_LIVES', '/tmp/lives')
|
2020-12-29 20:14:07 +00:00
|
|
|
LICENCES = config('LICENCES', './licences.txt')
|
2020-10-13 13:37:21 +00:00
|
|
|
"""This var is for save a snapshots in json format when fail something"""
|
2018-06-24 14:57:49 +00:00
|
|
|
API_DOC_CONFIG_TITLE = 'Devicehub'
|
|
|
|
API_DOC_CONFIG_VERSION = '0.2'
|
2022-04-08 09:10:03 +00:00
|
|
|
API_DOC_CONFIG_COMPONENTS = {'securitySchemes': {'bearerAuth': TokenAuth.API_DOCS}}
|
2018-06-24 14:57:49 +00:00
|
|
|
API_DOC_CLASS_DISCRIMINATOR = 'type'
|
2018-05-30 10:49:40 +00:00
|
|
|
|
2018-07-14 14:41:22 +00:00
|
|
|
PRICE_SOFTWARE = PriceSoftware.Ereuse
|
|
|
|
PRICE_VERSION = StrictVersion('1.0')
|
|
|
|
PRICE_CURRENCY = Currency.EUR
|
2019-06-19 11:35:26 +00:00
|
|
|
"""Official versions."""
|
2021-02-22 20:14:56 +00:00
|
|
|
|
|
|
|
"""Admin email"""
|
|
|
|
EMAIL_ADMIN = config('EMAIL_ADMIN', '')
|
2022-08-04 12:38:43 +00:00
|
|
|
EMAIL_DEMO = config('EMAIL_DEMO', 'hello@usody.com')
|
2021-05-12 09:47:03 +00:00
|
|
|
|
|
|
|
"""Definition of path where save the documents of customers"""
|
|
|
|
PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/')
|
2021-07-05 13:04:14 +00:00
|
|
|
JWT_PASS = config('JWT_PASS', '')
|
2022-09-30 17:04:37 +00:00
|
|
|
|
|
|
|
MAIL_SERVER = config('MAIL_SERVER', '')
|
|
|
|
MAIL_USERNAME = config('MAIL_USERNAME', '')
|
|
|
|
MAIL_PASSWORD = config('MAIL_PASSWORD', '')
|
|
|
|
MAIL_PORT = config('MAIL_PORT', 587)
|
|
|
|
MAIL_USE_TLS = config('MAIL_USE_TLS', True)
|
2022-10-19 11:35:53 +00:00
|
|
|
MAIL_DEFAULT_SENDER = config('MAIL_DEFAULT_SENDER', '')
|
2022-11-22 18:12:11 +00:00
|
|
|
API_DLT = config('API_DLT', None)
|
2023-01-25 12:20:43 +00:00
|
|
|
API_DLT_TOKEN = config('API_DLT_TOKEN', None)
|
2023-05-12 10:05:41 +00:00
|
|
|
|
|
|
|
"""Definition of oauth jwt details."""
|
|
|
|
OAUTH2_JWT_ENABLED = config('OAUTH2_JWT_ENABLED', False)
|
|
|
|
OAUTH2_JWT_ISS = config('OAUTH2_JWT_ISS', '')
|
|
|
|
OAUTH2_JWT_KEY = config('OAUTH2_JWT_KEY', None)
|
|
|
|
OAUTH2_JWT_ALG = config('OAUTH2_JWT_ALG', 'HS256')
|