Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Document config parser utility #8160

Closed
babolivier opened this issue Aug 25, 2020 · 1 comment · Fixed by #16714
Closed

Document config parser utility #8160

babolivier opened this issue Aug 25, 2020 · 1 comment · Fixed by #16714
Labels
A-Config Configuration, or the documentation thereof A-Docs things relating to the documentation P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution

Comments

@babolivier
Copy link
Contributor

babolivier commented Aug 25, 2020

We have a utility to run Synapse's config parsing code without starting a homeserver, which can be quite helpful, but it's undocummented and it looks like it was pretty much forgotten about.

We should document it.

The script currently requires the user to provide a config key to print after the config has been parsed, which we sometimes don't care about, so we should make this bit optional.

As a POI, this config check is run like this (in a Synapse venv):

python -m synapse.config read <config key to print> -c <path to config>

More generally, everything after the config key to print is passed to the config parser, so the usage of that bit (which in my example is -c <path to config>) is actually:

usage: __main__.py [-h] [-c CONFIG_FILE] [--keys-directory DIRECTORY] [-D] [--print-pidfile] [--manhole PORT] [-d SQLITE_DATABASE_PATH] [-n] [--enable-registration]

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-path CONFIG_FILE
                        Specify config file. Can be given multiple times and may specify directories containing *.yaml files.
  --keys-directory DIRECTORY
                        Where files such as certs and signing keys are stored when their location is not given explicitly in the config. Defaults to the directory containing the last config file

server:
  -D, --daemonize       Daemonize the homeserver
  --print-pidfile       Print the path to the pidfile just before daemonizing
  --manhole PORT        Turn on the twisted telnet manhole service on the given port.

database:
  -d SQLITE_DATABASE_PATH, --database-path SQLITE_DATABASE_PATH
                        The path to a sqlite database to use.

logging:
  -n, --no-redirect-stdio
                        Do not redirect stdout/stderr to the log

registration:
  --enable-registration
                        Enable registration for new users.
@babolivier babolivier added A-Config Configuration, or the documentation thereof A-Docs things relating to the documentation z-p2 (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution labels Aug 25, 2020
@babolivier
Copy link
Contributor Author

Note that as of #11145 one can also omit read <config key to print> from the incantation to just get Synapse to try to parse the configuration file to see if it parses fine.

@DMRobertson DMRobertson added T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches and removed z-p2 (Deprecated Label) labels Nov 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Config Configuration, or the documentation thereof A-Docs things relating to the documentation P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants