# Configuration

Both the CLI and the web application can be configured from a file.

Warning

The configuration file format is not stable yet and might change without any notice.

Note

Configuration file loading dependencies get installed automatically when installing the CLI or the web application extras.

The configuration file path can be specified either through the --config CLI option or through the READER_CONFIG environment variable (also usable with the web application).

The config file is split in contexts; this allows having a set of global defaults and overriding them with CLI- or web-app-specific values. Use the config dump --merge command to see the final configuration for each context.

The older READER_DB, READER_PLUGIN, and READER_APP_PLUGIN environment variables always replace the corresponding config values, so they should be used only for debugging.

The following example shows the config file structure and the options currently available:

# Contexts are values of the top level map.
# There are 3 known contexts: default, cli, and app.
#
# The default context can also be implicit: top level keys that don't
# correspond to a known context are assumed to belong to the default context.
#
# Thus, the following are equivalent:
#
#   default:
#       something else: ...
#
#   ---
#
#   something else: ...
#
# However, mixing them is an error:
#
#   default:
#   something else: ...

# default context.
#
# Provides default settings for the other contexts.

default:
url: /path/to/db.sqlite
feed_root: /path/to/feeds

#   <plugin import path>: <plugin options>
# map; options are ignored at the moment.
# Note that unlike other settings, plugins are merged, not replaced.
plugins:

# CLI context.

cli:
# When using the CLI, we want to use some additional reader plugins.
plugins:

# The cli context also allows changing the CLI defaults.
defaults:
# Note that while the --db and --plugin CLI options could appear here,
# doing it isn't very usful, since the CLI values (including defaults)
# always override the corresponding config file values.

# Options that can be passed multiple times take a list of values:

# Subcommand defaults can be given as nested maps:

# Flags take a boolean value:
update: yes

# update --workers 10 -vv
update:
workers: 10
# Flags that can be repeated take an integer:
verbose: 2

search:
# search update -v
update:
verbose: 1

# serve --port 8888
serve:
port: 8888

# Web application context.
#
# Used for both the serve command (python -m reader serve)
# and when using the WSGI application (reader._app.wsgi:app) directly.

app:
# When using the web app, we want to use an additional reader plugin.
plugins:

# ... and some app plugins.
plugins: