Oz API Configuration

The configuration settings are contained in theconfig.py file.

Initial Configuration

These parameters are mandatory. Please note: if you require the Instant API mode (with no data saved anywhere), set OZ_APP_COMPONENTS=stateless. Otherwise, to save data for orders and analyses, set OZ_APP_COMPONENTS=auth,stateful,oz_collections, where:

  • auth is an authentication module,

  • stateful is a module for full API,

  • oz_collections is a module for the blacklist analysis (remove if you don't use it).

# application components list
OZ_APP_COMPONENTS=auth,stateful,oz_collections
# enable local storage support
OZ_LOCAL_STORAGE_SUPPORT_ENABLE=false
# tfss service host
OZ_SERVICE_TFSS_HOST=http://xxx.xxx.xxx.xxx:xxxx
# allowed hosts
APP_ALLOWED_HOSTS=example-host1.com,example-host2.com
# secret key
OZ_API_SECRET_KEY=long_secret_key

Postgres Connection

This is needed only if you use the full API version.

DB_USER = 'user name'
DB_HOST = 'Postgres server address'
DB_PASS = 'user password'
DB_NAME = 'database name'

Path to Media Files

All incoming media files are saved in the local directory mounted to one of possible endpoints depending of the installation method:

  • host server or Docker container: /opt/gateway/static

  • in case of standalone installer: /var/lib/docker/volumes/api_oz-api-static-vol/_data

  • any path specified via configuration

In most of the integration cases, the media files can be accessed in web using the direct links to randomly generated filenames.

To access the media, you need to specify in the configuration file their external host name or IP address, port, and connection protocol.

PORT = 443
SCHEME = 'https'
HOST = 'api.globalbank.com'

Connection to Oz Bio / Liveness

OZ_SERVICE_TFSS_HOST = 'http://bio-server-name:8501/v1/'

Timing and Limits

# amount of retries to perform analyses to Oz Bio
OZ_CELERY_RETRY_MAX_COUNT = 7
# delay between tries
OZ_CELERY_RETRY_STEP = 30

# maximum wait time of one analyse
OZ_ANALYSE_PROCESSING_EXPIRE_TIMEOUT = 15 * 60  # 15 minutes
# maximum wait time of analyse from API
OZ_ANALYSE_DELIVERY_EXPIRE_TIMEOUT = 60 * 60  # 1 hour
# frequency for check analyse expiration
OZ_ANALYSE_EXPIRE_BEAT_PERIOD = 1 * 60  # every minute

# maximum amount of attached media
OZ_ATTACHMENT_MAX_COUNT = 10
# maximum size of one media file
OZ_ATTACHMENT_MAX_SIZE = 10 * 1024 * 1024  # 10Mb

# amount of seconds until access token expiration
OZ_SESSION_TTL = 60 * 15  # 15 minutes
# amount of seconds until service access token expiration
OZ_SESSION_LONGLIVE_TTL = 60 * 60 * 24 * 365 * 5  # 5 years

# maximum size of thumbnail in bytes
OZ_IMAGE_SIZE_THUMBNAIL = 300
# maximum duration of video file
OZ_VIDEO_DURATION_MAX = 30

Last updated

Was this helpful?