Configuration¶
The application can be configured with a configuration file, via command line arguments or by environment variables. All configuration options have default values. If a configuration option is specified in more than one place, then command line values override environment variables which override configuration file values which override defaults.
The following configuration options are available:
-
-h
,
--help
¶
Show help message and exit.
-
--print-configuration
¶
Print active configuration and exit.
-
--document-store-port
<port>
¶ Port of Kuha document store database. Defaults to ´`6001``. May also be controlled by setting environment variable:
KUHA_DS_PORT
.
-
--document-store-api-version
<api_version>
¶ Api version for document store. This gets prepended to the URL path. Defaults to
v0
. May also be controlled by setting environment variable:KUHA_DS_API_VERSION
.
-
--database-host
<database_host>
¶ Host/IP of the Document Store database. Defaults to
localhost
. May also be controlled by setting environment variable:KUHA_DS_DBHOST
-
--database-port
<port>
¶ Port of the Document Store database. Defaults to
27017
. May also be controlled by setting environment variable:KUHA_DS_DBPORT
-
--database-name
<name>
¶ Name of Document Store database. Defaults to
kuha_document_store
. May also be controlled by setting environment variable:KUHA_DS_DBMAME
-
--database-user-reader
<user>
¶ Username for database user having read-only rights. Defaults to
reader
. May also be controlled by setting environment variable:KUHA_DS_DBUSER_READER
-
--database-pass-reader
<password>
¶ Password for database user having read-only rights. Defaults to
reader
. May also be controlled by setting environment variable:KUHA_DS_DBPASS_READER
-
--database-user-editor
<user>
¶ Username for database user having editing rights. Defaults to
editor
. May also be controlled by setting environment variable:KUHA_DS_DBUSER_EDITOR
-
--database-pass-editor
<password>
¶ Password for database user having editing rights. Defaults to
editor
. May also be controlled by setting environment variable:KUHA_DS_DBPASS_EDITOR
-
--loglevel
<loglevel>
¶ Lowest logging level of log messages that get output. Valid values are logging levels supported by Python’s
logging
[CRITICAL,ERROR,WARNING,INFO,DEBUG]
. Defaults toINFO
. May also be controlled by setting environment variable:KUHA_LOGLEVEL
-
--logformat
<logformat>
¶ Logging format supported by
logging
. Defaults to%(asctime)s %(levelname)s(%(name)s): %(message)s)
May also be controlled by setting environment variable:KUHA_LOGFORMAT
Configuration file
Args that start with ‘–’ (eg. –document-store-port) can also be set
in a config file. The configuration file lookup searches the file
from current working directory and from the package directory.
The name of the configuration file is kuha_document_store.ini
.
Note
Invoke with --help
to print out config file lookup paths.
Environment variables
If the program will be run by using the scripts provided in scripts
subdirectory, the runtime environment can be controlled via scripts/runtime_env
,
which will be created by copying from scripts/runtime_env.dist
at
installation time by scripts/install_kuha_document_store_virtualenv.sh
.