import logging import os from sqlalchemy.pool import StaticPool, NullPool SERVICE_NAME = 'fingerprint-sweeper' SERVICE_VERSION = '1.0.0' TEST_ENVIRONMENT = 'test' DEV_ENVIRONMENT = 'dev' PROD_ENVIRONMENT = 'prod' QA_ENVIRONMENT = 'qa' LOGGER_NAME = 'fingerprint-sweeper' LOGGER_LEVEL = logging.INFO # export LOGGER_DSN=https://logs-01.loggly.com/inputs/LOGGLY_TOKEN/ows1/fingerprint-sweeper LOGGER_DSN = os.environ.get('LOGGER_DSN') environment = os.environ.get('Environment', DEV_ENVIRONMENT) # Database config # to point to DEV fingerprint_capture db: # export FPC_DB_URL='mysql+pymysql://:@dev-wpcorpsite.cb22xqmk0y0q.us-east-1.rds.amazonaws.com/fingerprint_capture' FPC_DB_URL = os.environ.get('FPC_DB_URL') # fingerprint_capture db connection string # to point to DEV art_relations db: # export AR_DB_URL='mysql+pymysql://:@mr.db.devorch.com/art_relations' AR_DB_URL = os.environ.get('AR_DB_URL') # art_relations db connection string # to point to DEV direct_delivery db: # export DD_DB_URL='mysql+pymysql://:@/direct_delivery' DD_DB_URL = os.environ.get('DD_DB_URL') # direct_delivery db connection string if environment == TEST_ENVIRONMENT: DB_ENGINE_SETTINGS = { 'echo': True, 'connect_args': { 'check_same_thread': False}, 'poolclass': StaticPool} FPC_DB_URL = 'sqlite://' AR_DB_URL = 'sqlite://' DD_DB_URL = 'sqlite://' else: DB_ENGINE_SETTINGS = {'poolclass': NullPool} # In general, SENTRY_DSN should not be set in development or test environments # If need to test Sentry in DEV environment: # export SENTRY_DSN=https://95f04437abb84cc4a7db526570e4887d:c758cfa937994617b2a3889bb6f67e01@app.getsentry.com/64288 SENTRY_DSN = os.environ.get('SENTRY_DSN') # Number of tuids to process at one time TUID_CHUNK_SIZE = 10000 # SQS # Name of queue to push to sqs_queue_name = "{}-fp_capture_backfill".format(environment) # Max number of messages per call to boto3 send_messages() # see https://boto3.readthedocs.org/en/latest/reference/services/sqs.html#SQS.Queue.send_messages SQS_MAX_BATCH_SIZE = 10 # Direct Delivery # Asset config for pulling filename paths PHYSICAL_LOCATION_ID = os.environ.get('DD_STORAGE_PHYSICAL_LOCATION_ID', 1) assert FPC_DB_URL, 'FPC_DB_URL is missing from the environment' assert AR_DB_URL, 'AR_DB_URL is missing from the environment' assert DD_DB_URL, 'DD_DB_URL is missing from the environment' assert PHYSICAL_LOCATION_ID, 'PHYSICAL_LOCATION_ID is missing from the environment'