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

Commit 8330fc9

Browse files
authored
Cleanup references to sample config in the docs and redirect users to configuration manual (#13077)
1 parent 0ceb3af commit 8330fc9

File tree

12 files changed

+73
-89
lines changed

12 files changed

+73
-89
lines changed

changelog.d/13077.doc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Clean up references to sample configuration and redirect users to the configuration manual instead.
2+
3+

docs/admin_api/user_admin_api.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ Body parameters:
124124
- `address` - string. Value of third-party ID.
125125
belonging to a user.
126126
- `external_ids` - array, optional. Allow setting the identifier of the external identity
127-
provider for SSO (Single sign-on). Details in
128-
[Sample Configuration File](../usage/configuration/homeserver_sample_config.html)
129-
section `sso` and `oidc_providers`.
127+
provider for SSO (Single sign-on). Details in the configuration manual under the
128+
sections [sso](../usage/configuration/config_documentation.md#sso) and [oidc_providers](../usage/configuration/config_documentation.md#oidc_providers).
130129
- `auth_provider` - string. ID of the external identity provider. Value of `idp_id`
131130
in the homeserver configuration. Note that no error is raised if the provided
132131
value is not in the homeserver configuration.

docs/code_style.md

+37-58
Original file line numberDiff line numberDiff line change
@@ -70,82 +70,61 @@ on save as they take a while and can be very resource intensive.
7070
- Avoid wildcard imports (`from synapse.types import *`) and
7171
relative imports (`from .types import UserID`).
7272

73-
## Configuration file format
73+
## Configuration code and documentation format
7474

75-
The [sample configuration file](./sample_config.yaml) acts as a
75+
When adding a configuration option to the code, if several settings are grouped into a single dict, ensure that your code
76+
correctly handles the top-level option being set to `None` (as it will be if no sub-options are enabled).
77+
78+
The [configuration manual](usage/configuration/config_documentation.md) acts as a
7679
reference to Synapse's configuration options for server administrators.
7780
Remember that many readers will be unfamiliar with YAML and server
78-
administration in general, so that it is important that the file be as
79-
easy to understand as possible, which includes following a consistent
80-
format.
81+
administration in general, so it is important that when you add
82+
a configuration option the documentation be as easy to understand as possible, which
83+
includes following a consistent format.
8184

8285
Some guidelines follow:
8386

84-
- Sections should be separated with a heading consisting of a single
85-
line prefixed and suffixed with `##`. There should be **two** blank
86-
lines before the section header, and **one** after.
87-
- Each option should be listed in the file with the following format:
88-
- A comment describing the setting. Each line of this comment
89-
should be prefixed with a hash (`#`) and a space.
87+
- Each option should be listed in the config manual with the following format:
88+
89+
- The name of the option, prefixed by `###`.
9090

91-
The comment should describe the default behaviour (ie, what
91+
- A comment which describes the default behaviour (i.e. what
9292
happens if the setting is omitted), as well as what the effect
9393
will be if the setting is changed.
94-
95-
Often, the comment end with something like "uncomment the
96-
following to <do action>".
97-
98-
- A line consisting of only `#`.
99-
- A commented-out example setting, prefixed with only `#`.
94+
- An example setting, using backticks to define the code block
10095

10196
For boolean (on/off) options, convention is that this example
102-
should be the *opposite* to the default (so the comment will end
103-
with "Uncomment the following to enable [or disable]
104-
<feature>." For other options, the example should give some
105-
non-default value which is likely to be useful to the reader.
106-
107-
- There should be a blank line between each option.
108-
- Where several settings are grouped into a single dict, *avoid* the
109-
convention where the whole block is commented out, resulting in
110-
comment lines starting `# #`, as this is hard to read and confusing
111-
to edit. Instead, leave the top-level config option uncommented, and
112-
follow the conventions above for sub-options. Ensure that your code
113-
correctly handles the top-level option being set to `None` (as it
114-
will be if no sub-options are enabled).
115-
- Lines should be wrapped at 80 characters.
116-
- Use two-space indents.
117-
- `true` and `false` are spelt thus (as opposed to `True`, etc.)
118-
- Use single quotes (`'`) rather than double-quotes (`"`) or backticks
119-
(`` ` ``) to refer to configuration options.
97+
should be the *opposite* to the default. For other options, the example should give
98+
some non-default value which is likely to be useful to the reader.
99+
100+
- There should be a horizontal rule between each option, which can be achieved by adding `---` before and
101+
after the option.
102+
- `true` and `false` are spelt thus (as opposed to `True`, etc.)
120103

121104
Example:
122105

106+
---
107+
### `modules`
108+
109+
Use the `module` sub-option to add a module under `modules` to extend functionality.
110+
The `module` setting then has a sub-option, `config`, which can be used to define some configuration
111+
for the `module`.
112+
113+
Defaults to none.
114+
115+
Example configuration:
123116
```yaml
124-
## Frobnication ##
125-
126-
# The frobnicator will ensure that all requests are fully frobnicated.
127-
# To enable it, uncomment the following.
128-
#
129-
#frobnicator_enabled: true
130-
131-
# By default, the frobnicator will frobnicate with the default frobber.
132-
# The following will make it use an alternative frobber.
133-
#
134-
#frobincator_frobber: special_frobber
135-
136-
# Settings for the frobber
137-
#
138-
frobber:
139-
# frobbing speed. Defaults to 1.
140-
#
141-
#speed: 10
142-
143-
# frobbing distance. Defaults to 1000.
144-
#
145-
#distance: 100
117+
modules:
118+
- module: my_super_module.MySuperClass
119+
config:
120+
do_thing: true
121+
- module: my_other_super_module.SomeClass
122+
config: {}
146123
```
124+
---
147125

148126
Note that the sample configuration is generated from the synapse code
149127
and is maintained by a script, `scripts-dev/generate_sample_config.sh`.
150128
Making sure that the output from this script matches the desired format
151129
is left as an exercise for the reader!
130+

docs/jwt.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ as follows:
4949
* For other installation mechanisms, see the documentation provided by the
5050
maintainer.
5151

52-
To enable the JSON web token integration, you should then add a `jwt_config` section
53-
to your configuration file (or uncomment the `enabled: true` line in the
54-
existing section). See [sample_config.yaml](./sample_config.yaml) for some
52+
To enable the JSON web token integration, you should then add a `jwt_config` option
53+
to your configuration file. See the [configuration manual](usage/configuration/config_documentation.md#jwt_config) for some
5554
sample settings.
5655

5756
## How to test JWT as a developer

docs/manhole.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ environments where untrusted users have shell access.
1313

1414
## Configuring the manhole
1515

16-
To enable it, first uncomment the `manhole` listener configuration in
17-
`homeserver.yaml`. The configuration is slightly different if you're using docker.
16+
To enable it, first add the `manhole` listener configuration in your
17+
`homeserver.yaml`. You can find information on how to do that
18+
in the [configuration manual](usage/configuration/config_documentation.md#manhole_settings).
19+
The configuration is slightly different if you're using docker.
1820

1921
#### Docker config
2022

docs/message_retention_policies.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ clients.
4949

5050
## Server configuration
5151

52-
Support for this feature can be enabled and configured in the
53-
`retention` section of the Synapse configuration file (see the
54-
[sample file](https://github.com/matrix-org/synapse/blob/v1.36.0/docs/sample_config.yaml#L451-L518)).
52+
Support for this feature can be enabled and configured by adding a the
53+
`retention` in the Synapse configuration file (see
54+
[configuration manual](usage/configuration/config_documentation.md#retention)).
5555

5656
To enable support for message retention policies, set the setting
5757
`enabled` in this section to `true`.
@@ -65,8 +65,8 @@ message retention policy configured in its state. This allows server
6565
admins to ensure that messages are never kept indefinitely in a server's
6666
database.
6767

68-
A default policy can be defined as such, in the `retention` section of
69-
the configuration file:
68+
A default policy can be defined as such, by adding the `retention` option in
69+
the configuration file and adding these sub-options:
7070

7171
```yaml
7272
default_policy:
@@ -86,8 +86,8 @@ Purge jobs are the jobs that Synapse runs in the background to purge
8686
expired events from the database. They are only run if support for
8787
message retention policies is enabled in the server's configuration. If
8888
no configuration for purge jobs is configured by the server admin,
89-
Synapse will use a default configuration, which is described in the
90-
[sample configuration file](https://github.com/matrix-org/synapse/blob/v1.36.0/docs/sample_config.yaml#L451-L518).
89+
Synapse will use a default configuration, which is described here in the
90+
[configuration manual](usage/configuration/config_documentation.md#retention).
9191

9292
Some server admins might want a finer control on when events are removed
9393
depending on an event's room's policy. This can be done by setting the
@@ -137,8 +137,8 @@ the server's database.
137137
### Lifetime limits
138138

139139
Server admins can set limits on the values of `max_lifetime` to use when
140-
purging old events in a room. These limits can be defined as such in the
141-
`retention` section of the configuration file:
140+
purging old events in a room. These limits can be defined under the
141+
`retention` option in the configuration file:
142142

143143
```yaml
144144
allowed_lifetime_min: 1d

docs/openid.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ as follows:
4545
maintainer.
4646

4747
To enable the OpenID integration, you should then add a section to the `oidc_providers`
48-
setting in your configuration file (or uncomment one of the existing examples).
49-
See [sample_config.yaml](./sample_config.yaml) for some sample settings, as well as
48+
setting in your configuration file.
49+
See the [configuration manual](usage/configuration/config_documentation.md#oidc_providers) for some sample settings, as well as
5050
the text below for example configurations for specific providers.
5151

5252
## Sample configs

docs/setup/forward_proxy.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ in Synapse can be deactivated.
6666

6767
**NOTE**: This has an impact on security and is for testing purposes only!
6868

69-
To deactivate the certificate validation, the following setting must be made in
70-
[homserver.yaml](../usage/configuration/homeserver_sample_config.md).
69+
To deactivate the certificate validation, the following setting must be added to
70+
your [homserver.yaml](../usage/configuration/homeserver_sample_config.md).
7171

7272
```yaml
7373
use_insecure_ssl_client_just_for_testing_do_not_use: true

docs/setup/installation.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -407,21 +407,23 @@ The recommended way to do so is to set up a reverse proxy on port
407407
Alternatively, you can configure Synapse to expose an HTTPS port. To do
408408
so, you will need to edit `homeserver.yaml`, as follows:
409409

410-
- First, under the `listeners` section, uncomment the configuration for the
411-
TLS-enabled listener. (Remove the hash sign (`#`) at the start of
412-
each line). The relevant lines are like this:
410+
- First, under the `listeners` option, add the configuration for the
411+
TLS-enabled listener like so:
413412

414413
```yaml
414+
listeners:
415415
- port: 8448
416416
type: http
417417
tls: true
418418
resources:
419419
- names: [client, federation]
420420
```
421421
422-
- You will also need to uncomment the `tls_certificate_path` and
423-
`tls_private_key_path` lines under the `TLS` section. You will need to manage
424-
provisioning of these certificates yourself.
422+
- You will also need to add the options `tls_certificate_path` and
423+
`tls_private_key_path`. to your configuration file. You will need to manage provisioning of
424+
these certificates yourself.
425+
- You can find more information about these options as well as how to configure synapse in the
426+
[configuration manual](../usage/configuration/config_documentation.md).
425427

426428
If you are using your own certificate, be sure to use a `.pem` file that
427429
includes the full certificate chain including any intermediate certificates

docs/usage/configuration/config_documentation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2999,7 +2999,7 @@ This setting has the following sub-options:
29992999
* `localdb_enabled`: Set to false to disable authentication against the local password
30003000
database. This is ignored if `enabled` is false, and is only useful
30013001
if you have other `password_providers`. Defaults to true.
3002-
* `pepper`: Set the value here to a secret random string for extra security. # Uncomment and change to a secret random string for extra security.
3002+
* `pepper`: Set the value here to a secret random string for extra security.
30033003
DO NOT CHANGE THIS AFTER INITIAL SETUP!
30043004
* `policy`: Define and enforce a password policy, such as minimum lengths for passwords, etc.
30053005
Each parameter is optional. This is an implementation of MSC2000. Parameters are as follows:

docs/usage/configuration/user_authentication/single_sign_on/cas.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Synapse supports authenticating users via the [Central Authentication
44
Service protocol](https://en.wikipedia.org/wiki/Central_Authentication_Service)
55
(CAS) natively.
66

7-
Please see the `cas_config` and `sso` sections of the [Synapse configuration
8-
file](../../../configuration/homeserver_sample_config.md) for more details.
7+
Please see the [cas_config](../../../configuration/config_documentation.md#cas_config) and [sso](../../../configuration/config_documentation.md#sso)
8+
sections of the configuration manual for more details.

synapse/config/emailconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
145145
raise ConfigError(
146146
'The config option "trust_identity_server_for_password_resets" '
147147
'has been replaced by "account_threepid_delegate". '
148-
"Please consult the sample config at docs/sample_config.yaml for "
148+
"Please consult the configuration manual at docs/usage/configuration/config_documentation.md for "
149149
"details and update your config file."
150150
)
151151

0 commit comments

Comments
 (0)