Settings

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

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

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

On some systems, files beginning with a dot are hidden by default. Thus, .env file can't be seen using standard files 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 worker to process request. Workers silent for more than this many 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 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

While, HTTPS and CORS can be set directly on webservice, we strongly recommend running reverse-proxy in front and move configuration to proxy itself.

Option

Default

Description

CORS_ORIGINS

no default, that means web browser will allow requests to webserver only from a same domain

origin, allowed to use API

CORS_METHODS

all methods

methods, allowed to invoke on API. Specify comma-separated values as single string (ex. "GET,POST,PUT")

CORS_HEADERS

all headers

headers, allowed to read from API. Specify comma-separated values as single string (ex. "content-type,date")

See a great article about CORS from Mozilla

Option

Default

Description

HTTPS

"false"

If enabled, serve webservice 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.

Use key file without passphrase. Passphrase causes webserver to crash, or infinity await stdin.

Logging

There are 3 log types in our service:

  1. access logs - are just standard HTTP access logs.

  2. application logs - regular application logs, including errors and debug messages.

  3. document process results logs - stores document processing input and results in 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.

Access and applications logs are printed to stdout.

For access and applications logs files day-based rotation occurs every midnight UTC. Service keeps the last 30 days of logs files.

Application

Option

Default

Description

RFID_PKD_PA_PATH

Specify a folder with custom certs for rfid PA