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-06-10 16:47:49 +00:00
|
|
|
from typing import Set
|
2020-09-29 07:42:05 +00:00
|
|
|
from decouple import config
|
2018-04-27 17:16:43 +00:00
|
|
|
|
2018-06-24 14:57:49 +00:00
|
|
|
from teal.auth import TokenAuth
|
2018-04-10 15:06:39 +00:00
|
|
|
from teal.config import Config
|
2018-08-03 16:15:08 +00:00
|
|
|
from teal.enums import Currency
|
2018-07-22 20:42:49 +00:00
|
|
|
from teal.utils import import_resource
|
2018-04-10 15:06:39 +00:00
|
|
|
|
2020-03-12 16:07:35 +00:00
|
|
|
from ereuse_devicehub.resources import action, agent, deliverynote, inventory, \
|
|
|
|
lot, proof, tag, user
|
2018-10-04 08:59:31 +00:00
|
|
|
from ereuse_devicehub.resources.device import definitions
|
2018-11-21 13:26:56 +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-09-15 11:22:28 +00:00
|
|
|
from ereuse_devicehub.resources.versions import versions
|
2020-11-18 10:31:23 +00:00
|
|
|
from ereuse_devicehub.resources.assigned import definitions as assigned_def
|
2018-09-07 10:38:02 +00:00
|
|
|
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
class DevicehubConfig(Config):
|
2018-10-04 08:59:31 +00:00
|
|
|
RESOURCE_DEFINITIONS = set(chain(import_resource(definitions),
|
2019-05-11 14:27:22 +00:00
|
|
|
import_resource(action),
|
2018-07-22 20:42:49 +00:00
|
|
|
import_resource(user),
|
|
|
|
import_resource(tag),
|
2018-08-08 19:25:53 +00:00
|
|
|
import_resource(agent),
|
2018-11-21 13:26:56 +00:00
|
|
|
import_resource(lot),
|
2020-02-26 19:21:59 +00:00
|
|
|
import_resource(deliverynote),
|
2020-03-11 23:40:41 +00:00
|
|
|
import_resource(proof),
|
2019-01-23 15:55:04 +00:00
|
|
|
import_resource(documents),
|
2020-09-15 11:22:28 +00:00
|
|
|
import_resource(inventory),
|
2020-11-16 19:32:28 +00:00
|
|
|
import_resource(versions),
|
2020-11-18 10:31:23 +00:00
|
|
|
import_resource(assigned_def)),
|
2018-11-21 13:26:56 +00:00
|
|
|
)
|
2018-06-10 16:47:49 +00:00
|
|
|
PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str]
|
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')
|
|
|
|
SQLALCHEMY_DATABASE_URI = 'postgresql://{user}:{pw}@{host}/{db}'.format(
|
|
|
|
user=DB_USER,
|
|
|
|
pw=DB_PASSWORD,
|
|
|
|
host=DB_HOST,
|
|
|
|
db=DB_DATABASE,
|
|
|
|
) # type: str
|
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
|
|
|
"""
|
2020-10-13 13:37:21 +00:00
|
|
|
|
|
|
|
TMP_SNAPSHOTS = config('TMP_SNAPSHOTS', '/tmp/snapshots')
|
|
|
|
"""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'
|
|
|
|
API_DOC_CONFIG_COMPONENTS = {
|
|
|
|
'securitySchemes': {
|
|
|
|
'bearerAuth': TokenAuth.API_DOCS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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."""
|