Module licenseware.common.constants.envs

Here envs is a class which holds environment variables information.

Uppercase attributes are computed at startup and they can't hold dynamic variables envs.LWARE_USER is the value got from os.getenv('LWARE_IDENTITY_USER')

Lowercase attributes are computed on calling them as they are methods envs.get_auth_token() get_auth_token is a class method which is returns a dynamically gathered variable

Make all methods classmethods That way we can call them like this envs.get_auth_token() instead of this envs.get_auth_token()

Expand source code
"""

Here `envs` is a class which holds environment variables information.

Uppercase attributes are computed at startup and they can't hold dynamic variables
`envs.LWARE_USER` is the value got from os.getenv('LWARE_IDENTITY_USER')


Lowercase attributes are computed on calling them as they are methods
`envs.get_auth_token()`
`get_auth_token` is a class method which is returns a dynamically gathered variable


Make all methods classmethods 
That way we can call them like this `envs.get_auth_token()` instead of this `envs().get_auth_token()`


"""

import os
import uuid
from dataclasses import dataclass


def get_upload_path_on_desktop():

    default_upload_path = os.path.join(os.getcwd(), 'uploaded_files')
    upload_path_file = os.path.join(os.getcwd(), "upload_path.txt")
    if os.path.exists(upload_path_file):
        with open(upload_path_file, "r") as f:
            upload_path = f.read()
        if upload_path == "":
            return default_upload_path
        else:
            return upload_path

    return default_upload_path


# Atention!
# > To keep this file short please add only variables used on most/all apps


@dataclass
class envs:

    # Environment variables available at startup
    DESKTOP_ENVIRONMENT: bool = os.getenv("ENVIRONMENT") == "desktop"
    DESKTOP_TENANT_ID: str = str(uuid.uuid5(uuid.NAMESPACE_OID, "desktop-user")) # '2655d513-9883-5b7e-8a14-c030bc1ca3b8'
    APP_ID: str = os.environ["APP_ID"] if not DESKTOP_ENVIRONMENT else 'api'
    LWARE_USER: str = os.environ["LWARE_IDENTITY_USER"] if not DESKTOP_ENVIRONMENT else 'user'
    LWARE_PASSWORD: str = os.environ["LWARE_IDENTITY_PASSWORD"] if not DESKTOP_ENVIRONMENT else 'pass'
    DEBUG: bool = os.getenv("DEBUG") == "true"
    ENVIRONMENT: str = os.getenv("ENVIRONMENT", "production") if not DESKTOP_ENVIRONMENT else 'desktop'
    USE_BACKGROUND_WORKER: bool = os.getenv("USE_BACKGROUND_WORKER", "true") == "true" if not DESKTOP_ENVIRONMENT else False

    AUTH_SERVICE_URL: str = os.environ["AUTH_SERVICE_URL"] if not DESKTOP_ENVIRONMENT else 'http://localhost:5000/api/auth'
    AUTH_MACHINES_URL: str = AUTH_SERVICE_URL + "/machines"
    AUTH_MACHINE_CHECK_URL: str = AUTH_SERVICE_URL + "/machine_authorization"
    AUTH_USER_CHECK_URL: str = AUTH_SERVICE_URL + "/verify"
    AUTH_TENANTS_URL: str = AUTH_SERVICE_URL + "/tenants"
    AUTH_USER_PROFILE_URL: str = AUTH_SERVICE_URL + "/profile"
    AUTH_USER_TABLES_URL: str = AUTH_SERVICE_URL + "/users/tables"

    REGISTRY_SERVICE_URL: str = os.environ["REGISTRY_SERVICE_URL"] if not DESKTOP_ENVIRONMENT else 'http://localhost:5000/api/registry-service'
    REGISTER_ALL_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/registrations"
    REGISTER_APP_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/apps"
    REGISTER_UPLOADER_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/uploaders"
    GET_UPLOADERS_URL: str = REGISTRY_SERVICE_URL + "/uploaders"
    REGISTER_UPLOADER_STATUS_URL: str = (
        REGISTRY_SERVICE_URL + "/v1" + "/uploaders/status"
    )
    REGISTER_REPORT_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/reports"
    REGISTER_REPORT_COMPONENT_URL: str = REGISTER_REPORT_URL + "/v1" + "/components"

    APP_HOST: str = os.environ['APP_HOST'] if not DESKTOP_ENVIRONMENT else 'http://localhost:5000'
    QUEUE_NAME: str = APP_ID if os.path.exists("Procfile.local") else APP_ID.replace("-service", "")
    APP_PATH: str = "/" + QUEUE_NAME
    BASE_URL: str = APP_HOST + APP_PATH

    UPLOAD_PATH: str = "/uploads"
    REPORT_PATH: str = "/reports"
    FEATURE_PATH: str = "/features"
    DATA_SYNC_PATH: str = "/datasync"
    REPORT_COMPONENT_PATH: str = "/report-components"
    UPLOAD_URL: str = BASE_URL + UPLOAD_PATH
    REPORT_URL: str = BASE_URL + REPORT_PATH
    FEATURES_URL: str = BASE_URL + FEATURE_PATH
    REPORT_COMPONENT_URL: str = BASE_URL + REPORT_COMPONENT_PATH
    FILE_UPLOAD_PATH: str = os.getenv("FILE_UPLOAD_PATH", "tmp/lware") if not DESKTOP_ENVIRONMENT else get_upload_path_on_desktop()
    DEPLOYMENT_SUFFIX: str = os.getenv("DEPLOYMENT_SUFFIX")

    # Mongo connection
    MONGO_DATABASE_NAME: str = (
        os.getenv("MONGO_DATABASE_NAME") or os.getenv("MONGO_DB_NAME") or "db"
    )
    MONGO_CONNECTION_STRING: str = (
        os.getenv("MONGO_CONNECTION_STRING") or "mongodb://localhost:27017/db"
    )

    # !!! Add here ONLY collection names that are USED on ALL or MOST of the APPS !!!
    # For APP SPECIFIC mongo collection names you can always create a data class in `common`/`utils` or other app package.
    # Another solution would be to extend this class and import it from the file you are extending it.
    COLLECTION_PREFIX = os.getenv("COLLECTION_PREFIX", QUEUE_NAME.upper())
    MONGO_COLLECTION_DATA_NAME: str = COLLECTION_PREFIX + "Data"
    MONGO_COLLECTION_UTILIZATION_NAME: str = COLLECTION_PREFIX + "Quota"
    MONGO_COLLECTION_ANALYSIS_NAME: str = (
        COLLECTION_PREFIX + "History"
    )  # Depreciated use MONGO_COLLECTION_HISTORY_NAME instead
    MONGO_COLLECTION_HISTORY_NAME: str = COLLECTION_PREFIX + "ProcessingHistory"
    MONGO_COLLECTION_UPLOADERS_STATUS_NAME: str = COLLECTION_PREFIX + "UploadersStatus"
    MONGO_COLLECTION_REPORT_SNAPSHOTS_NAME: str = (
        COLLECTION_PREFIX + "ReportSnapshots"
    )  #! OUTDATED NEEDS PAGINATION
    MONGO_COLLECTION_FEATURES_NAME: str = COLLECTION_PREFIX + "Features"

    # Redis connection
    REDIS_HOST: str = os.getenv("REDIS_HOST", "localhost")
    REDIS_PORT: int = int(os.getenv("REDIS_PORT", "6379"))
    REDIS_DB: int = int(os.getenv("REDIS_DB", "0"))
    REDIS_PASSWORD: str = os.getenv("REDIS_PASSWORD")

    REDIS_RESULT_CACHE_DB: int = int(os.getenv("REDIS_RESULT_CACHE_DB", "15"))

    # Environment variables added later by the app
    # envs.method_name() - calls the variable dynamically
    # you can access class vars with cls.attr_name ex: cls.MONGO_COLLECTION_DATA_NAME
    @classmethod
    def get_auth_token(cls):
        return os.getenv("AUTH_TOKEN")

    @classmethod
    def get_auth_token_datetime(cls):
        return os.getenv("AUTH_TOKEN_DATETIME")

    @classmethod
    def app_is_authenticated(cls):
        return os.getenv("APP_AUTHENTICATED") == "true"

    @classmethod
    def environment_is_local(cls):
        return os.getenv("ENVIRONMENT") == "local"

    @classmethod
    def get_tenant_upload_path(cls, tenant_id: str):
        DESKTOP_ENVIRONMENT = os.getenv("ENVIRONMENT") == "desktop"
        FILE_UPLOAD_PATH = os.getenv("FILE_UPLOAD_PATH", "tmp/lware") if not DESKTOP_ENVIRONMENT else get_upload_path_on_desktop()
        return os.path.join(FILE_UPLOAD_PATH, tenant_id)

Functions

def get_upload_path_on_desktop()
Expand source code
def get_upload_path_on_desktop():

    default_upload_path = os.path.join(os.getcwd(), 'uploaded_files')
    upload_path_file = os.path.join(os.getcwd(), "upload_path.txt")
    if os.path.exists(upload_path_file):
        with open(upload_path_file, "r") as f:
            upload_path = f.read()
        if upload_path == "":
            return default_upload_path
        else:
            return upload_path

    return default_upload_path

Classes

class envs (DESKTOP_ENVIRONMENT: bool = True, DESKTOP_TENANT_ID: str = '2655d513-9883-5b7e-8a14-c030bc1ca3b8', APP_ID: str = 'api', LWARE_USER: str = 'user', LWARE_PASSWORD: str = 'pass', DEBUG: bool = False, ENVIRONMENT: str = 'desktop', USE_BACKGROUND_WORKER: bool = False, AUTH_SERVICE_URL: str = 'http://localhost:5000/api/auth', AUTH_MACHINES_URL: str = 'http://localhost:5000/api/auth/machines', AUTH_MACHINE_CHECK_URL: str = 'http://localhost:5000/api/auth/machine_authorization', AUTH_USER_CHECK_URL: str = 'http://localhost:5000/api/auth/verify', AUTH_TENANTS_URL: str = 'http://localhost:5000/api/auth/tenants', AUTH_USER_PROFILE_URL: str = 'http://localhost:5000/api/auth/profile', AUTH_USER_TABLES_URL: str = 'http://localhost:5000/api/auth/users/tables', REGISTRY_SERVICE_URL: str = 'http://localhost:5000/api/registry-service', REGISTER_ALL_URL: str = 'http://localhost:5000/api/registry-service/v1/registrations', REGISTER_APP_URL: str = 'http://localhost:5000/api/registry-service/v1/apps', REGISTER_UPLOADER_URL: str = 'http://localhost:5000/api/registry-service/v1/uploaders', GET_UPLOADERS_URL: str = 'http://localhost:5000/api/registry-service/uploaders', REGISTER_UPLOADER_STATUS_URL: str = 'http://localhost:5000/api/registry-service/v1/uploaders/status', REGISTER_REPORT_URL: str = 'http://localhost:5000/api/registry-service/v1/reports', REGISTER_REPORT_COMPONENT_URL: str = 'http://localhost:5000/api/registry-service/v1/reports/v1/components', APP_HOST: str = 'http://localhost:5000', QUEUE_NAME: str = 'api', APP_PATH: str = '/api', BASE_URL: str = 'http://localhost:5000/api', UPLOAD_PATH: str = '/uploads', REPORT_PATH: str = '/reports', FEATURE_PATH: str = '/features', DATA_SYNC_PATH: str = '/datasync', REPORT_COMPONENT_PATH: str = '/report-components', UPLOAD_URL: str = 'http://localhost:5000/api/uploads', REPORT_URL: str = 'http://localhost:5000/api/reports', FEATURES_URL: str = 'http://localhost:5000/api/features', REPORT_COMPONENT_URL: str = 'http://localhost:5000/api/report-components', FILE_UPLOAD_PATH: str = '/home/acmt/Documents/lware/licenseware-sdk-v2/uploaded_files', DEPLOYMENT_SUFFIX: str = None, MONGO_DATABASE_NAME: str = 'db', MONGO_CONNECTION_STRING: str = 'mongodb://localhost:27017/db', MONGO_COLLECTION_DATA_NAME: str = 'APIData', MONGO_COLLECTION_UTILIZATION_NAME: str = 'APIQuota', MONGO_COLLECTION_ANALYSIS_NAME: str = 'APIHistory', MONGO_COLLECTION_HISTORY_NAME: str = 'APIProcessingHistory', MONGO_COLLECTION_UPLOADERS_STATUS_NAME: str = 'APIUploadersStatus', MONGO_COLLECTION_REPORT_SNAPSHOTS_NAME: str = 'APIReportSnapshots', MONGO_COLLECTION_FEATURES_NAME: str = 'APIFeatures', REDIS_HOST: str = 'localhost', REDIS_PORT: int = 6379, REDIS_DB: int = 0, REDIS_PASSWORD: str = None, REDIS_RESULT_CACHE_DB: int = 15)

envs(DESKTOP_ENVIRONMENT: bool = True, DESKTOP_TENANT_ID: str = '2655d513-9883-5b7e-8a14-c030bc1ca3b8', APP_ID: str = 'api', LWARE_USER: str = 'user', LWARE_PASSWORD: str = 'pass', DEBUG: bool = False, ENVIRONMENT: str = 'desktop', USE_BACKGROUND_WORKER: bool = False, AUTH_SERVICE_URL: str = 'http://localhost:5000/api/auth', AUTH_MACHINES_URL: str = 'http://localhost:5000/api/auth/machines', AUTH_MACHINE_CHECK_URL: str = 'http://localhost:5000/api/auth/machine_authorization', AUTH_USER_CHECK_URL: str = 'http://localhost:5000/api/auth/verify', AUTH_TENANTS_URL: str = 'http://localhost:5000/api/auth/tenants', AUTH_USER_PROFILE_URL: str = 'http://localhost:5000/api/auth/profile', AUTH_USER_TABLES_URL: str = 'http://localhost:5000/api/auth/users/tables', REGISTRY_SERVICE_URL: str = 'http://localhost:5000/api/registry-service', REGISTER_ALL_URL: str = 'http://localhost:5000/api/registry-service/v1/registrations', REGISTER_APP_URL: str = 'http://localhost:5000/api/registry-service/v1/apps', REGISTER_UPLOADER_URL: str = 'http://localhost:5000/api/registry-service/v1/uploaders', GET_UPLOADERS_URL: str = 'http://localhost:5000/api/registry-service/uploaders', REGISTER_UPLOADER_STATUS_URL: str = 'http://localhost:5000/api/registry-service/v1/uploaders/status', REGISTER_REPORT_URL: str = 'http://localhost:5000/api/registry-service/v1/reports', REGISTER_REPORT_COMPONENT_URL: str = 'http://localhost:5000/api/registry-service/v1/reports/v1/components', APP_HOST: str = 'http://localhost:5000', QUEUE_NAME: str = 'api', APP_PATH: str = '/api', BASE_URL: str = 'http://localhost:5000/api', UPLOAD_PATH: str = '/uploads', REPORT_PATH: str = '/reports', FEATURE_PATH: str = '/features', DATA_SYNC_PATH: str = '/datasync', REPORT_COMPONENT_PATH: str = '/report-components', UPLOAD_URL: str = 'http://localhost:5000/api/uploads', REPORT_URL: str = 'http://localhost:5000/api/reports', FEATURES_URL: str = 'http://localhost:5000/api/features', REPORT_COMPONENT_URL: str = 'http://localhost:5000/api/report-components', FILE_UPLOAD_PATH: str = '/home/acmt/Documents/lware/licenseware-sdk-v2/uploaded_files', DEPLOYMENT_SUFFIX: str = None, MONGO_DATABASE_NAME: str = 'db', MONGO_CONNECTION_STRING: str = 'mongodb://localhost:27017/db', MONGO_COLLECTION_DATA_NAME: str = 'APIData', MONGO_COLLECTION_UTILIZATION_NAME: str = 'APIQuota', MONGO_COLLECTION_ANALYSIS_NAME: str = 'APIHistory', MONGO_COLLECTION_HISTORY_NAME: str = 'APIProcessingHistory', MONGO_COLLECTION_UPLOADERS_STATUS_NAME: str = 'APIUploadersStatus', MONGO_COLLECTION_REPORT_SNAPSHOTS_NAME: str = 'APIReportSnapshots', MONGO_COLLECTION_FEATURES_NAME: str = 'APIFeatures', REDIS_HOST: str = 'localhost', REDIS_PORT: int = 6379, REDIS_DB: int = 0, REDIS_PASSWORD: str = None, REDIS_RESULT_CACHE_DB: int = 15)

Expand source code
class envs:

    # Environment variables available at startup
    DESKTOP_ENVIRONMENT: bool = os.getenv("ENVIRONMENT") == "desktop"
    DESKTOP_TENANT_ID: str = str(uuid.uuid5(uuid.NAMESPACE_OID, "desktop-user")) # '2655d513-9883-5b7e-8a14-c030bc1ca3b8'
    APP_ID: str = os.environ["APP_ID"] if not DESKTOP_ENVIRONMENT else 'api'
    LWARE_USER: str = os.environ["LWARE_IDENTITY_USER"] if not DESKTOP_ENVIRONMENT else 'user'
    LWARE_PASSWORD: str = os.environ["LWARE_IDENTITY_PASSWORD"] if not DESKTOP_ENVIRONMENT else 'pass'
    DEBUG: bool = os.getenv("DEBUG") == "true"
    ENVIRONMENT: str = os.getenv("ENVIRONMENT", "production") if not DESKTOP_ENVIRONMENT else 'desktop'
    USE_BACKGROUND_WORKER: bool = os.getenv("USE_BACKGROUND_WORKER", "true") == "true" if not DESKTOP_ENVIRONMENT else False

    AUTH_SERVICE_URL: str = os.environ["AUTH_SERVICE_URL"] if not DESKTOP_ENVIRONMENT else 'http://localhost:5000/api/auth'
    AUTH_MACHINES_URL: str = AUTH_SERVICE_URL + "/machines"
    AUTH_MACHINE_CHECK_URL: str = AUTH_SERVICE_URL + "/machine_authorization"
    AUTH_USER_CHECK_URL: str = AUTH_SERVICE_URL + "/verify"
    AUTH_TENANTS_URL: str = AUTH_SERVICE_URL + "/tenants"
    AUTH_USER_PROFILE_URL: str = AUTH_SERVICE_URL + "/profile"
    AUTH_USER_TABLES_URL: str = AUTH_SERVICE_URL + "/users/tables"

    REGISTRY_SERVICE_URL: str = os.environ["REGISTRY_SERVICE_URL"] if not DESKTOP_ENVIRONMENT else 'http://localhost:5000/api/registry-service'
    REGISTER_ALL_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/registrations"
    REGISTER_APP_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/apps"
    REGISTER_UPLOADER_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/uploaders"
    GET_UPLOADERS_URL: str = REGISTRY_SERVICE_URL + "/uploaders"
    REGISTER_UPLOADER_STATUS_URL: str = (
        REGISTRY_SERVICE_URL + "/v1" + "/uploaders/status"
    )
    REGISTER_REPORT_URL: str = REGISTRY_SERVICE_URL + "/v1" + "/reports"
    REGISTER_REPORT_COMPONENT_URL: str = REGISTER_REPORT_URL + "/v1" + "/components"

    APP_HOST: str = os.environ['APP_HOST'] if not DESKTOP_ENVIRONMENT else 'http://localhost:5000'
    QUEUE_NAME: str = APP_ID if os.path.exists("Procfile.local") else APP_ID.replace("-service", "")
    APP_PATH: str = "/" + QUEUE_NAME
    BASE_URL: str = APP_HOST + APP_PATH

    UPLOAD_PATH: str = "/uploads"
    REPORT_PATH: str = "/reports"
    FEATURE_PATH: str = "/features"
    DATA_SYNC_PATH: str = "/datasync"
    REPORT_COMPONENT_PATH: str = "/report-components"
    UPLOAD_URL: str = BASE_URL + UPLOAD_PATH
    REPORT_URL: str = BASE_URL + REPORT_PATH
    FEATURES_URL: str = BASE_URL + FEATURE_PATH
    REPORT_COMPONENT_URL: str = BASE_URL + REPORT_COMPONENT_PATH
    FILE_UPLOAD_PATH: str = os.getenv("FILE_UPLOAD_PATH", "tmp/lware") if not DESKTOP_ENVIRONMENT else get_upload_path_on_desktop()
    DEPLOYMENT_SUFFIX: str = os.getenv("DEPLOYMENT_SUFFIX")

    # Mongo connection
    MONGO_DATABASE_NAME: str = (
        os.getenv("MONGO_DATABASE_NAME") or os.getenv("MONGO_DB_NAME") or "db"
    )
    MONGO_CONNECTION_STRING: str = (
        os.getenv("MONGO_CONNECTION_STRING") or "mongodb://localhost:27017/db"
    )

    # !!! Add here ONLY collection names that are USED on ALL or MOST of the APPS !!!
    # For APP SPECIFIC mongo collection names you can always create a data class in `common`/`utils` or other app package.
    # Another solution would be to extend this class and import it from the file you are extending it.
    COLLECTION_PREFIX = os.getenv("COLLECTION_PREFIX", QUEUE_NAME.upper())
    MONGO_COLLECTION_DATA_NAME: str = COLLECTION_PREFIX + "Data"
    MONGO_COLLECTION_UTILIZATION_NAME: str = COLLECTION_PREFIX + "Quota"
    MONGO_COLLECTION_ANALYSIS_NAME: str = (
        COLLECTION_PREFIX + "History"
    )  # Depreciated use MONGO_COLLECTION_HISTORY_NAME instead
    MONGO_COLLECTION_HISTORY_NAME: str = COLLECTION_PREFIX + "ProcessingHistory"
    MONGO_COLLECTION_UPLOADERS_STATUS_NAME: str = COLLECTION_PREFIX + "UploadersStatus"
    MONGO_COLLECTION_REPORT_SNAPSHOTS_NAME: str = (
        COLLECTION_PREFIX + "ReportSnapshots"
    )  #! OUTDATED NEEDS PAGINATION
    MONGO_COLLECTION_FEATURES_NAME: str = COLLECTION_PREFIX + "Features"

    # Redis connection
    REDIS_HOST: str = os.getenv("REDIS_HOST", "localhost")
    REDIS_PORT: int = int(os.getenv("REDIS_PORT", "6379"))
    REDIS_DB: int = int(os.getenv("REDIS_DB", "0"))
    REDIS_PASSWORD: str = os.getenv("REDIS_PASSWORD")

    REDIS_RESULT_CACHE_DB: int = int(os.getenv("REDIS_RESULT_CACHE_DB", "15"))

    # Environment variables added later by the app
    # envs.method_name() - calls the variable dynamically
    # you can access class vars with cls.attr_name ex: cls.MONGO_COLLECTION_DATA_NAME
    @classmethod
    def get_auth_token(cls):
        return os.getenv("AUTH_TOKEN")

    @classmethod
    def get_auth_token_datetime(cls):
        return os.getenv("AUTH_TOKEN_DATETIME")

    @classmethod
    def app_is_authenticated(cls):
        return os.getenv("APP_AUTHENTICATED") == "true"

    @classmethod
    def environment_is_local(cls):
        return os.getenv("ENVIRONMENT") == "local"

    @classmethod
    def get_tenant_upload_path(cls, tenant_id: str):
        DESKTOP_ENVIRONMENT = os.getenv("ENVIRONMENT") == "desktop"
        FILE_UPLOAD_PATH = os.getenv("FILE_UPLOAD_PATH", "tmp/lware") if not DESKTOP_ENVIRONMENT else get_upload_path_on_desktop()
        return os.path.join(FILE_UPLOAD_PATH, tenant_id)

Class variables

var APP_HOST : str
var APP_ID : str
var APP_PATH : str
var AUTH_MACHINES_URL : str
var AUTH_MACHINE_CHECK_URL : str
var AUTH_SERVICE_URL : str
var AUTH_TENANTS_URL : str
var AUTH_USER_CHECK_URL : str
var AUTH_USER_PROFILE_URL : str
var AUTH_USER_TABLES_URL : str
var BASE_URL : str
var COLLECTION_PREFIX
var DATA_SYNC_PATH : str
var DEBUG : bool
var DEPLOYMENT_SUFFIX : str
var DESKTOP_ENVIRONMENT : bool
var DESKTOP_TENANT_ID : str
var ENVIRONMENT : str
var FEATURES_URL : str
var FEATURE_PATH : str
var FILE_UPLOAD_PATH : str
var GET_UPLOADERS_URL : str
var LWARE_PASSWORD : str
var LWARE_USER : str
var MONGO_COLLECTION_ANALYSIS_NAME : str
var MONGO_COLLECTION_DATA_NAME : str
var MONGO_COLLECTION_FEATURES_NAME : str
var MONGO_COLLECTION_HISTORY_NAME : str
var MONGO_COLLECTION_REPORT_SNAPSHOTS_NAME : str
var MONGO_COLLECTION_UPLOADERS_STATUS_NAME : str
var MONGO_COLLECTION_UTILIZATION_NAME : str
var MONGO_CONNECTION_STRING : str
var MONGO_DATABASE_NAME : str
var QUEUE_NAME : str
var REDIS_DB : int
var REDIS_HOST : str
var REDIS_PASSWORD : str
var REDIS_PORT : int
var REDIS_RESULT_CACHE_DB : int
var REGISTER_ALL_URL : str
var REGISTER_APP_URL : str
var REGISTER_REPORT_COMPONENT_URL : str
var REGISTER_REPORT_URL : str
var REGISTER_UPLOADER_STATUS_URL : str
var REGISTER_UPLOADER_URL : str
var REGISTRY_SERVICE_URL : str
var REPORT_COMPONENT_PATH : str
var REPORT_COMPONENT_URL : str
var REPORT_PATH : str
var REPORT_URL : str
var UPLOAD_PATH : str
var UPLOAD_URL : str
var USE_BACKGROUND_WORKER : bool

Static methods

def app_is_authenticated()
Expand source code
@classmethod
def app_is_authenticated(cls):
    return os.getenv("APP_AUTHENTICATED") == "true"
def environment_is_local()
Expand source code
@classmethod
def environment_is_local(cls):
    return os.getenv("ENVIRONMENT") == "local"
def get_auth_token()
Expand source code
@classmethod
def get_auth_token(cls):
    return os.getenv("AUTH_TOKEN")
def get_auth_token_datetime()
Expand source code
@classmethod
def get_auth_token_datetime(cls):
    return os.getenv("AUTH_TOKEN_DATETIME")
def get_tenant_upload_path(tenant_id: str)
Expand source code
@classmethod
def get_tenant_upload_path(cls, tenant_id: str):
    DESKTOP_ENVIRONMENT = os.getenv("ENVIRONMENT") == "desktop"
    FILE_UPLOAD_PATH = os.getenv("FILE_UPLOAD_PATH", "tmp/lware") if not DESKTOP_ENVIRONMENT else get_upload_path_on_desktop()
    return os.path.join(FILE_UPLOAD_PATH, tenant_id)