summary refs log tree commit diff
path: root/synapse/config/_base.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use StrCollection in additional places. (#16301)Patrick Cloke2023-09-131-2/+1
|
* Add the ability to use `G` (GiB) and `T` (TiB) suffixes in configuration ↵reivilibre2023-09-061-3/+4
| | | | | | | | | | | | | options that refer to numbers of bytes. (#16219) * Add more suffixes to `parse_size` * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Bump ruff from 0.0.277 to 0.0.286 (#16198)dependabot[bot]2023-08-291-4/+4
| | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Re-type config paths in `ConfigError`s to be `StrSequence`s (#15615)Sean Quah2023-05-181-1/+2
| | | | | | Part of #14809. Signed-off-by: Sean Quah <seanq@matrix.org>
* Prefer `type(x) is int` to `isinstance(x, int)` (#14945)David Robertson2023-01-311-22/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Perfer `type(x) is int` to `isinstance(x, int)` This covered all additional instances I could see where `x` was user-controlled. The remaining cases are ``` $ rg -s 'isinstance.*[^_]int' tests/replication/_base.py 576: if isinstance(obj, int): synapse/util/caches/stream_change_cache.py 136: assert isinstance(stream_pos, int) 214: assert isinstance(stream_pos, int) 246: assert isinstance(stream_pos, int) 267: assert isinstance(stream_pos, int) synapse/replication/tcp/external_cache.py 133: if isinstance(result, int): synapse/metrics/__init__.py 100: if isinstance(calls, (int, float)): synapse/handlers/appservice.py 262: assert isinstance(new_token, int) synapse/config/_util.py 62: if isinstance(p, int): ``` which cover metrics, logic related to `jsonschema`, and replication and data streams. AFAICS these are all internal to Synapse * Changelog
* Generate missing configuration files at startup (#13615)Richard van der Hoff2022-08-261-11/+48
| | | | | | | | If things like the signing key file are missing, let's just try to generate them on startup. Again, this is useful for k8s-like deployments where we just want to generate keys on the first run.
* Remove 'anonymised' from the phone home stats documentation (#13321)Andrew Morgan2022-07-191-7/+7
|
* Remove code generating comments in configuration file (#12941)Shay2022-06-141-2/+8
|
* Reload cache factors from disk on SIGHUP (#12673)David Robertson2022-05-111-7/+74
|
* Add missing type hints to config classes. (#12402)Patrick Cloke2022-04-111-4/+1
|
* Move scripts directory inside synapse, exposing as setuptools entry_points ↵David Robertson2022-03-021-1/+1
| | | | | | | | | | | | (#12118) * Two scripts are basically entry_points already * Move and rename scripts/* to synapse/_scripts/*.py * Delete sync_room_to_group.pl * Expose entry points in setup.py * Update linter script and config * Fixup scripts & docs mentioning scripts that moved Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add missing type hints to config base classes (#11377)Patrick Cloke2021-11-231-64/+93
|
* Require direct references to configuration variables. (#10985)Patrick Cloke2021-10-061-56/+8
| | | | | | This removes the magic allowing accessing configurable variables directly from the config object. It is now required that a specific configuration class is used (e.g. `config.foo` must be replaced with `config.server.foo`).
* Use direct references for configuration variables (part 6). (#10916)Patrick Cloke2021-09-291-1/+1
|
* Fix race conditions when creating media store and config directories (#10913)Sean Quah2021-09-271-7/+2
|
* Allow using several custom template directories (#10587)Brendan Abolivier2021-08-171-18/+25
| | | Allow using several directories in read_templates.
* Remove support for ACME v1 (#10194)Brendan Abolivier2021-06-171-5/+0
| | | | | Fixes #9778 ACME v1 has been fully decommissioned for existing installs on June 1st 2021(see https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430/27), so we can now safely remove it from Synapse.
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* JWT OIDC secrets for Sign in with Apple (#9549)Richard van der Hoff2021-03-091-4/+34
| | | | | Apple had to be special. They want a client secret which is generated from an EC key. Fixes #9220. Also fixes #9212 while I'm here.
* Clean up `ShardedWorkerHandlingConfig` (#9466)Erik Johnston2021-02-241-9/+27
| | | | | | | | | | | | | | | | | * Split ShardedWorkerHandlingConfig This is so that we have a type level understanding of when it is safe to call `get_instance(..)` (as opposed to `should_handle(..)`). * Remove special cases in ShardedWorkerHandlingConfig. `ShardedWorkerHandlingConfig` tried to handle the various different ways it was possible to configure federation senders and pushers. This led to special cases that weren't hit during testing. To fix this the handling of the different cases is moved from there and `generic_worker` into the worker config class. This allows us to have the logic in one place and allows the rest of the code to ignore the different cases.
* Add documentation and type hints to parse_duration. (#9432)Patrick Cloke2021-02-191-2/+15
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-4/+8
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Merge branch 'social_login' into developRichard van der Hoff2021-02-011-35/+4
|\
| * Replace username picker with a template (#9275)Richard van der Hoff2021-02-011-35/+4
| | | | | | | | | | There's some prelimiary work here to pull out the construction of a jinja environment to a separate function. I wanted to load the template at display time rather than load time, so that it's easy to update on the fly. Honestly, I think we should do this with all our templates: the risk of ending up with malformed templates is far outweighed by the improved turnaround time for an admin trying to update them.
* | Clean-up the template loading code. (#9200)Patrick Cloke2021-01-271-16/+26
|/ | | | | * Enables autoescape by default for HTML files. * Adds a new read_template method for reading a single template. * Some logic clean-up.
* Give `public_baseurl` a default value (#9159)Richard van der Hoff2021-01-201-5/+6
|
* Better formatting for config errors from modules (#8874)Richard van der Hoff2020-12-081-2/+12
| | | | | | | | | | The idea is that the parse_config method of extension modules can raise either a ConfigError or a JsonValidationError, and it will be magically turned into a legible error message. There's a few components to it: * Separating the "path" and the "message" parts of a ConfigError, so that we can fiddle with the path bit to turn it into an absolute path. * Generally improving the way ConfigErrors get printed. * Passing in the config path to load_module so that it can wrap any exceptions that get caught appropriately.
* Convert additional templates to Jinja (#8444)Patrick Cloke2020-10-021-6/+5
| | | This converts a few more of our inline HTML templates to Jinja. This is somewhat part of #7280 and should make it a bit easier to customize these in the future.
* Merge branch 'master' into developAndrew Morgan2020-09-241-2/+8
|\
| * Hotfix: disable autoescape by default when rendering Jinja2 templates (#8394)Andrew Morgan2020-09-241-2/+8
| | | | | | | | | | #8037 changed the default `autoescape` option when rendering Jinja2 templates from `False` to `True`. This caused some bugs, noticeably around redirect URLs being escaped in SAML2 auth confirmation templates, causing those URLs to break for users. This change returns the previous behaviour as it stood. We may want to look at each template individually and see whether autoescaping is a good idea at some point, but for now lets just fix the breakage.
* | Add experimental support for sharding event persister. Again. (#8294)Erik Johnston2020-09-141-3/+18
|/ | | | | | This is *not* ready for production yet. Caveats: 1. We should write some tests... 2. The stream token that we use for events can get stalled at the minimum position of all writers. This means that new events may not be processed and e.g. sent down sync streams if a writer isn't writing or is slow.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-2/+2
|
* Revert "Add experimental support for sharding event persister. (#8170)" (#8242)Brendan Abolivier2020-09-041-18/+3
| | | | | | | * Revert "Add experimental support for sharding event persister. (#8170)" This reverts commit 82c1ee1c22a87b9e6e3179947014b0f11c0a1ac3. * Changelog
* Add experimental support for sharding event persister. (#8170)Erik Johnston2020-09-021-3/+18
| | | | | | This is *not* ready for production yet. Caveats: 1. We should write some tests... 2. The stream token that we use for events can get stalled at the minimum position of all writers. This means that new events may not be processed and e.g. sent down sync streams if a writer isn't writing or is slow.
* Use the default templates when a custom template file cannot be found (#8037)Andrew Morgan2020-08-171-1/+99
| | | Fixes https://github.com/matrix-org/synapse/issues/6583
* Add ability to run multiple pusher instances (#7855)Erik Johnston2020-07-161-2/+36
| | | This reuses the same scheme as federation sender sharding
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-4/+2
|
* Don't crash when one of the configuration files is empty (#7341)Brendan Abolivier2020-04-271-0/+6
| | | | | If the admin adds a `.yaml` file that's either empty or doesn't parse into a dict to a config directory (e.g. `conf.d` for debs installs), stuff like https://github.com/matrix-org/synapse/issues/7322 would happen. This PR checks that the file is correctly parsed into a dict, or ignores it with a warning if it parses into any other type (including `None` for empty files). Fixes https://github.com/matrix-org/synapse/issues/7322
* Fix --help commandline argument (#7249)Richard van der Hoff2020-04-091-16/+8
| | | | | | | | I don't really remember why this was so complicated; I think it dates back to the time when we had to instantiate the Config classes before we could call `add_arguments` - ie before #5597. In any case, I don't think there's a good reason for it any more, and the impact of it being complicated is that `--help` doesn't work correctly.
* Improve database configuration docs (#6988)Richard van der Hoff2020-03-201-2/+0
| | | | | Attempts to clarify the sample config for databases, and add some stuff about tcp keepalives to `postgres.md`.
* Add a warning about indentation to generated config (#6920)Richard van der Hoff2020-02-141-2/+14
| | | Fixes #6916.
* Refactor HomeserverConfig so it can be typechecked (#6137)Amber Brown2019-10-101-43/+148
|
* Config templating (#5900)Jorik Schellekens2019-08-281-0/+37
| | | | | | | | | | | | Template config files * Imagine a system composed entirely of x, y, z etc and the basic operations.. Wait George, why XOR? Why not just neq? George: Eh, I didn't think of that.. Co-Authored-By: Erik Johnston <erik@matrix.org>
* Clean up arg name and remove lying commentErik Johnston2019-07-161-7/+5
|
* Fix invoking add_argument from homeserver.pyErik Johnston2019-07-151-1/+1
|
* Move creation of ArgumentParser to callerErik Johnston2019-07-151-10/+5
|
* Fix up commentsErik Johnston2019-07-151-1/+1
|
* Change add_arguments to be a static methodErik Johnston2019-07-151-1/+31
|
* Add basic admin cmd appErik Johnston2019-07-021-3/+45
|
* Add "--open-private-ports" cmdline optionRichard van der Hoff2019-06-241-0/+14
| | | | This is helpful when generating a config file for running synapse under docker.
* Add --data-directory commandline argumentRichard van der Hoff2019-06-241-0/+15
| | | | We don't necessarily want to put the data in the cwd.
* Don't load the generated config as the default.Richard van der Hoff2019-06-241-66/+30
| | | | It's too confusing.
* Ensure that all config options have sensible defaultsRichard van der Hoff2019-06-241-5/+5
| | | | | This will enable us to skip the unintuitive behaviour where the generated config and default config are the same thing.
* Remove unused Config.config_dir_path attributeRichard van der Hoff2019-06-241-3/+0
| | | | This is no longer used and only serves to confuse.
* Pass config_dir_path and data_dir_path into Config.read_config. (#5522)Richard van der Hoff2019-06-241-34/+70
| | | | | | * Pull config_dir_path and data_dir_path calculation out of read_config_files * Pass config_dir_path and data_dir_path into read_config
* Improve help and cmdline option names for --generate-config options (#5512)Richard van der Hoff2019-06-211-22/+28
| | | | | | | * group the arguments together into a group * add new names "--generate-missing-config" and "--config-directory" for existing cmdline options "--generate-keys" and "--keys-dir", which better reflect their purposes.
* Refactor Config parser and add some comments. (#5511)Richard van der Hoff2019-06-211-14/+35
| | | | Add some comments, and simplify `read_config_files`.
* Improve logging when generating config files (#5510)Richard van der Hoff2019-06-211-1/+2
| | | Make it a bit clearer what's going on.
* Run Black. (#5482)Amber Brown2019-06-201-7/+5
|
* Use yaml safe_loadErik Johnston2019-03-221-3/+3
|
* Use a regular HomeServerConfig object for unit testsRichard van der Hoff2019-03-191-1/+4
| | | | | | | Rather than using a Mock for the homeserver config, use a genuine HomeServerConfig object. This makes for a more realistic test, and means that we don't have to keep remembering to add things to the mock config every time we add a new config setting.
* Allow passing --daemonize to workersErik Johnston2019-03-131-1/+7
|
* Include a default configuration file in the 'docs' directory. (#4791)Richard van der Hoff2019-03-041-11/+16
|
* fix self-signed cert notice from generate-configRichard van der Hoff2019-02-121-7/+2
| | | | fixes #4620
* Support ACME for certificate provisioning (#4384)Amber Brown2019-01-231-2/+2
|
* Add a script to generate a clean config file (#4315)Richard van der Hoff2018-12-221-13/+43
|
* Make scripts/ and scripts-dev/ pass pyflakes (and the rest of the codebase ↵Amber Brown2018-10-201-62/+59
| | | | on py3) (#4068)
* run isortAmber Brown2018-07-091-1/+2
|
* Open config file in non-bytes modeAdrian Tschira2018-04-101-3/+3
| | | | | | | | | Nothing written into it is encoded, so it makes little sense, but it does break in python3 the way it was before. The variable names were adjusted to be less misleading. Signed-off-by: Adrian Tschira <nota@notafile.com>
* Merge pull request #3074 from NotAFile/fix-py3-printsRichard van der Hoff2018-04-091-5/+5
|\ | | | | use python3-compatible prints
| * use python3-compatible printsAdrian Tschira2018-04-061-5/+5
| |
* | Replace some type checks with six type checksAdrian Tschira2018-04-071-2/+4
|/ | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* Improve error handling for missing files (#2551)Richard van der Hoff2017-10-171-10/+26
| | | | | | | | | | | `os.path.exists` doesn't allow us to distinguish between permissions errors and the path actually not existing, which repeatedly confuses people. It also means that we try to overwrite existing key files, which is super-confusing. (cf issues #2455, #2379). Use os.stat instead. Also, don't recomemnd the the use of --generate-config, which screws everything up if you're using debian (cf #2455).
* Add support for durations in minutesDaniel Dent2016-11-121-2/+3
|
* Add function to load config without generating itMark Haines2016-06-091-43/+104
| | | | | | | | | | | | | | | | Renames ``load_config`` to ``load_or_generate_config`` Adds a method called ``load_config`` that just loads the config. The main synapse.app.homeserver will continue to use ``load_or_generate_config`` to retain backwards compat. However new worker processes can use ``load_config`` to load the config avoiding some of the cruft needed to generate the config. As the new ``load_config`` method is expected to be used by new configs it removes support for the legacy commandline overrides that ``load_or_generate_config`` supports
* Use syntax that works on both py2.7 and py3Mark Haines2016-03-071-1/+1
|
* Error if macaroon key is missing from configDaniel Wagner-Hall2016-02-051-13/+22
| | | | | | | | | | | | | Currently we store all access tokens in the DB, and fall back to that check if we can't validate the macaroon, so our fallback works here, but for guests, their macaroons don't get persisted, so we don't get to find them in the database. Each restart, we generate a new ephemeral key, so guests lose access after each server restart. I tried to fix up the config stuff to be less insane, but gave up, so instead I bolt on yet another piece of custom one-off insanity. Also, add some basic tests for config generation and loading.
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* CommentErik Johnston2015-11-191-0/+2
|
* Split out text for missing config options.Erik Johnston2015-11-181-16/+26
| | | | | This allows packages to more easily override the default messages to include package specific options.
* Fix race creating directoriesDaniel Wagner-Hall2015-11-121-1/+5
|
* Front-load spacesDaniel Wagner-Hall2015-09-221-7/+7
|
* Implement configurable stats reportingDaniel Wagner-Hall2015-09-221-4/+41
| | | | | | | | | | SYN-287 This requires that HS owners either opt in or out of stats reporting. When --generate-config is passed, --report-stats must be specified If an already-generated config is used, and doesn't have the report_stats key, it is requested to be set.
* Lists use 'append'Erik Johnston2015-09-021-1/+1
|
* Actually add config pathErik Johnston2015-08-281-0/+2
|
* Merge pull request #250 from matrix-org/erikj/generated_directoryErik Johnston2015-08-251-2/+15
|\ | | | | Add config option to specify where generated files should be dumped
| * Update config docErik Johnston2015-08-251-1/+2
| |
| * s/--generated-directory/--keys-directory/Erik Johnston2015-08-251-7/+7
| |
| * Add config option to specify where generated files should be dumpedErik Johnston2015-08-251-2/+14
| |
* | Warn if we encounter unexpected files in config directoriesErik Johnston2015-08-251-7/+17
|/
* Allow specifying directories as config filesErik Johnston2015-08-251-6/+24
|
* Fix the --generate-keys option. Make it do the same thing as ↵Mark Haines2015-08-121-45/+36
| | | | --generate-config does when the config file exists, but without printing a warning
* Add a --generate-keys optionPaul "LeoNerd" Evans2015-08-071-0/+9
|
* Correct -H SERVER_NAME in config-missing complaint messagePaul "LeoNerd" Evans2015-06-161-2/+2
|
* Merge branch 'develop' of github.com:matrix-org/synapse into developDavid Baker2015-05-071-18/+29
|\
| * Fix the --help option for synapseMark Haines2015-05-051-18/+29
| |
* | TypoDavid Baker2015-05-071-1/+1
|/
* Allow generate-config to run against an existing config file to generate ↵Mark Haines2015-05-011-12/+23
| | | | default keys
* Write a default log_config when generating configMark Haines2015-04-301-1/+2
|
* Don't break when sizes or durations are given as integersMark Haines2015-04-301-9/+12
|
* Allow multiple config files, set up a default config before applying the ↵Mark Haines2015-04-301-21/+37
| | | | config files
* Manually generate the default config yaml, remove most of the commandline ↵Mark Haines2015-04-301-65/+76
| | | | arguments for synapse anticipating that people will use the yaml instead. Simpify implementing config options by not requiring the classes to hit the super class
* Merge branch 'develop' into key_distributionMark Haines2015-04-291-3/+4
|\ | | | | | | | | Conflicts: synapse/config/homeserver.py
| * Output vim style mode markers into the yaml config fileMark Haines2015-04-281-3/+4
| |
* | Add config for setting the perspective serversMark Haines2015-04-241-2/+2
| |
* | Add a config file for perspective serversMark Haines2015-04-241-0/+11
|/
* Add a cache for get_eventMark Haines2015-02-111-0/+10
|
* Convert directory paths to absolute paths before daemonizingMark Haines2015-02-091-2/+3
|
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* Merge branch 'hotfixes-v0.5.4' of github.com:matrix-org/synapse into developErik Johnston2014-12-131-2/+2
|\
| * Fix bug while generating the error message when a file path specified in the ↵Erik Johnston2014-12-131-2/+2
| | | | | | | | config doesn't exist
* | Get uploads working with new media repoMark Haines2014-12-021-0/+14
|/
* Be more helpful and tell the user how to generate a config too.David Baker2014-11-141-1/+4
|
* Adding --generate-config will not help if the user has not specified a ↵David Baker2014-11-141-1/+1
| | | | config file.
* Fix pep8 warningsMark Haines2014-10-301-6/+13
|
* Fix ncorrect ports in documentation and add notes on how generate-config ↵David Baker2014-10-021-1/+2
| | | | | | also generates certs bound to whatever hostname you give with --generate-config. SYN-87 #resolved
* Update README setup instructions to be correct. Make synapse spit out ↵David Baker2014-10-021-0/+1
| | | | explanatory note when generating config to tell people to look at it and customise it.
* Added a TODO note about YAML modeline for editorsPaul "LeoNerd" Evans2014-09-031-0/+3
|
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* Add copyright notices and fix pyflakes errorsMark Haines2014-09-031-2/+0
|
* os.makedirs is almost but not entirely unlike mkdir -pMark Haines2014-09-021-1/+2
|
* Make the config directory if the directory doesn't exisit when generating configMark Haines2014-09-021-0/+1
|
* More helpful error messages for missing configMark Haines2014-09-021-2/+23
|
* Use yaml for config fileMark Haines2014-09-011-11/+6
|
* Fix homeserver config parsingMark Haines2014-09-011-5/+18
|
* Add config tree to synapse. Add support for reading config from a fileMark Haines2014-08-311-0/+99