diff --git a/docs/configuration.rst b/docs/configuration.rst --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1,48 +1,59 @@ .. _swh-fuse-config: + Configuration ============= -All configuration for the Software Heritage virtual file system should be done -in a single `.yml` file, containing the following fields: +The configuration for the Software Heritage virtual file system resides in the +``swh > fuse`` section of the shared `YAML `_ configuration +file used by all Software Heritage tools, located by default at +``~/.config/swh/global.yml``. + +The configuration file location is subject to the `XDG Base Directory +`_ specification as +well as explicitly overridden on the :ref:`command line ` via the +``-C/--config-file`` flag. -- `cache`: +The following sub-sections and fields can be used within the `swh > fuse` +stanza: - - `metadata`: where to store the metadata cache, must have either a - `in-memory` boolean entry or a `path` string entry (with the corresponding - disk path) - - `blob`: where to store the blob cache, same entries as the `metadata` cache +- ``cache``: -- `web-api`: + - ``metadata``: where to store the metadata cache, must have either a + ``in-memory`` boolean entry or a ``path`` string entry (with the + corresponding disk path) + - ``blob``: where to store the blob cache, same entries as the ``metadata`` + cache - - `url`: archive API URL - - `auth-token`: authentication token used with the API URL +- ``web-api``: -Set the `-C/--config-file` option of the :ref:`CLI ` to use your -configuration file. + - ``url``: archive API URL + - ``auth-token``: authentication token used with the API URL If no configuration is given, default values are: -- `cache`: all cache files are stored in `$XDG_CACHE_HOME/swh/fuse/` (or - `$HOME/.cache/swh/fuse` if `XDG_CACHE_HOME` is not set) -- `web-api`: default URL is https://archive.softwareheritage.org/api/1/ (with no - authentication token) +- ``cache``: all cache files are stored in ``$XDG_CACHE_HOME/swh/fuse/`` (or + ``~/.cache/swh/fuse`` if ``XDG_CACHE_HOME`` is not set) +- ``web-api``: default URL is , + with no authentication token Example ------- -Here is a complete example showcasing different cache storage strategies -(in-memory for metadata and on-disk for blob), using the default Web API -service: +Here is a full ``~/.config/swh/global.yml`` example, showcasing different cache +storage strategies (in-memory for metadata and on-disk for blob), using the +default Web API service: .. code:: yaml - cache: - metadata: - in-memory: true - blob: - path: "/path/to/cache/blob.sqlite" - web-api: - url: "https://archive.softwareheritage.org/api/1/" - auth-token: null + swh: + fuse: + cache: + metadata: + in-memory: true + blob: + path: "/path/to/cache/blob.sqlite" + web-api: + url: "https://archive.softwareheritage.org/api/1/" + auth-token: null diff --git a/docs/index.rst b/docs/index.rst --- a/docs/index.rst +++ b/docs/index.rst @@ -8,5 +8,6 @@ :caption: Overview cli + configuration Design notes - /apidoc/swh.fuse + API reference diff --git a/swh/fuse/cli.py b/swh/fuse/cli.py --- a/swh/fuse/cli.py +++ b/swh/fuse/cli.py @@ -49,7 +49,7 @@ "--config-file", default=None, type=click.Path(exists=True, dir_okay=False, path_type=str), - help="YAML configuration file", + help=f"Configuration file (default: {DEFAULT_CONFIG_PATH})", ) @click.pass_context def fuse(ctx, config_file):