Skip to content

Settings

Overview

The Document Reader web service is configured via env variables. To avoid names conflict with other tools, use the DOCREADER_ prefix. While it is not mandatory, we strongly recommend setting the options with prefixes. For readability, we will use the primary name for all the settings below.

All relative paths below are sub-paths for the installation folder, or the /app/ folder for docker. Let's call it the app root folder.

To make configuration a bit easier, use the .env file. The .env file is located under the app root folder. This file is a text file containing key-value pairs of all the settings required by your application. Using the .env file will enable you to set environment variables for the web service without polluting the global environment namespace.

Warning

On some systems, files beginning with a dot are hidden by default. Thus, the .env file can't be seen using the standard file viewers or `ls` like commands.

General

Option Default Description
BIND 0.0.0.0:8080 IpAddress:port server binding
WORKERS 1 number of workers to process requests
BACKLOG WORKERS x 15 maximum number of requests in a queue awaiting processing
TIMEOUT 30 number of seconds for the worker to process the request. Workers that are silent for more than this number of seconds are killed and restarted.
ENABLE_DEMO_WEB_APP "true" serve a demo web app under host root url (ex. localhost:8080/ )
ROUTING_PREFIX add a url prefix to all endpoints (ex. localhost:8080/{prefix}/ )
LIC_URL [docker only] URL to regula.license file for further download, if the mount option is not available
HTTPS_PROXY

HTTP proxy, used to connect to the license service. Do not specify protocol prefix in proxy URL.

Do not specify protocol prefix in proxy URL. Instead HTTPS_PROXY=http(s)://host:port use HTTPS_PROXY=host:port

If you use your own TSL certs, place them in /etc/ssl/certs folder in Linux and docker envs.

HTTPS and CORS

Warning

While HTTPS and CORS can be set directly on the web service, we strongly recommend running reverse-proxy in front and moving configuration to proxy itself.

Option Default Description
CORS_ORIGINS no default, that means the web browser will allow requests to the web server from the same domain only origin, allowed to use API
CORS_METHODS all methods methods, allowed to invoke on the API. Specify comma-separated values as single string (ex. "GET,POST,PUT")
CORS_HEADERS all headers headers, allowed to read from the API. Specify comma-separated values as a single string (ex. "content-type,date")

Info

For more details, see a great article about CORS from Mozilla.

Option Default Description
HTTPS "false" if enabled, serve web service via HTTPS using cert and key, specified in options below
CERT_FILE "certs/cert.pem" specifies a file containing cert file
KEY_FILE "certs/key.pem" specifies a file containing cert key file

Warning

Use key file without passphrase. Passphrase causes the web server to crash, or infinitely await stdin.

Logging

There are 3 log types in our service:

  1. access logs are just standard HTTP access logs.
  2. application logs are regular application logs, including errors and debug messages.
  3. document process results logs store document processing input and results in the JSON format.

    Space-consuming option, up to a few tens of Mb per request. Disabled by default.

Option Default Description
LOGS_ACCESS_CONSOLE "false" controls whether to print access logs to a console
LOGS_ACCESS_FILE "false" controls whether to save access logs to a file
LOGS_ACCESS_FILE_PATH "logs/access/document-reader-access.log" specifies a file to save access logs if LOGS_ACCESS_FILE enabled
LOGS_APP_CONSOLE "true" controls whether to print application logs to a console
LOGS_APP_FILE "false" on Docker \/ "true" on other installations controls whether to save application logs to a file
LOGS_APP_FILE_PATH "logs/app/document-reader-app.log" specifies a file to save access logs if LOGS_APP_FILE enabled
PROCESS_RESULTS_LOG_PATH "logs/process" specifies a folder to save document process results. Final output is a zip file, located in yyyy/mm/dd/hh folder under specified in this property root path.
LOGS_LEVEL "info" specify application logs level. Possible values: "error", "warn", "info", "debug".
LOGS_FORMATTER "text" possible values: "text"/"json". Some log collectors require logs to be printed in json format.

The access and application logs are printed to stdout.

For the access and applications log files, a day-based rotation occurs every midnight UTC. The service keeps the last 30 days of log files.

Application

Option Default Description
RFID_PKD_PA_PATH specify a folder with custom certs for rfid PA
Back to top