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

Remove code generating comments in configuration file #12941

Merged
merged 54 commits into from
Jun 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b788ea8
add info about config documentation to file header
H-Shay May 18, 2022
370a36b
remove comments from api.py
H-Shay May 18, 2022
74e171b
remove comments from appservice.py
H-Shay May 18, 2022
9fce9af
remove comments from auth.py
H-Shay May 18, 2022
c8ebd3e
remove comments from background_updates.py
H-Shay May 18, 2022
e17b3e5
remove comments from cache.py
H-Shay May 18, 2022
bf7c543
remove comments from captcha.py
H-Shay May 18, 2022
6d30891
remove comments from cas.py
H-Shay May 18, 2022
ad320d3
remove comments from consent.py
H-Shay May 18, 2022
d67d26b
remove comments from database.py
H-Shay May 18, 2022
91bd93d
remove comments from emailconfig.py
H-Shay May 18, 2022
7957222
remove comments from federation.py
H-Shay May 18, 2022
f6e29de
remove comments from federation.py
H-Shay May 18, 2022
004e2ae
remove comments from groups.py
H-Shay May 18, 2022
650332c
remove comments from jwt.py
H-Shay May 18, 2022
b246258
remove comments from modules.py
H-Shay May 19, 2022
11d9f22
remove comments from oembed.py
H-Shay May 19, 2022
9e47700
remove comments from oidc.py
H-Shay May 19, 2022
ee3c658
remove comments from push.py
H-Shay May 19, 2022
6b1cfc3
remove comments from ratelimiting.py
H-Shay May 19, 2022
6babef8
remove comments from redis.py
H-Shay May 19, 2022
22cd3d8
remove comments from retention.py
H-Shay May 19, 2022
29a9e2f
remove comments from room.py
H-Shay May 19, 2022
b449597
remove comments in room_directory.py
H-Shay May 19, 2022
9647714
remove comments from saml2.py
H-Shay May 19, 2022
e090c1e
remove comments from server_notices.py
H-Shay May 19, 2022
b8f32fa
remvoe comments from sso.py
H-Shay May 19, 2022
b6393d4
remove comments from stats.py
H-Shay May 19, 2022
bbce92b
remove comments from tracer.py
H-Shay May 19, 2022
099f79f
remove comments from user_directory.py
H-Shay May 19, 2022
01b88e0
remove comments from voip.py
H-Shay May 19, 2022
b2d0418
remove comments from workers.py
H-Shay May 19, 2022
bb88cc1
remove comments from repository.py
H-Shay May 19, 2022
e797906
remove comments from registration.py
H-Shay May 19, 2022
a925e0e
remove comments from tls.py
H-Shay May 19, 2022
bb52e28
remove comments from server.py
H-Shay May 19, 2022
b97a3e7
remove comments from metrics.py
H-Shay May 19, 2022
e01e1d4
update sample_config_header
H-Shay May 19, 2022
65ff8a0
slight refactor to generate whole config from parts
H-Shay May 31, 2022
60bbdbd
sample config
H-Shay May 31, 2022
2c1211f
remove comments from logger.py
H-Shay May 31, 2022
c66db44
remove comments from key.py
H-Shay May 31, 2022
0925fd3
merge in develop
H-Shay May 31, 2022
573b399
changelog
H-Shay Jun 1, 2022
210e8b1
lint + proper changelog number
H-Shay Jun 1, 2022
408c45e
regenerate sample config
H-Shay Jun 1, 2022
10d2613
remove printed shared secret from tests where unnecessary
H-Shay Jun 1, 2022
04881af
fix issue with registration shared secret not being string
H-Shay Jun 1, 2022
f5b16c1
requested changes
H-Shay Jun 7, 2022
18d7a87
regenerate config
H-Shay Jun 7, 2022
40cbc96
requested changes
H-Shay Jun 9, 2022
bb1b2bb
actually requested change
H-Shay Jun 9, 2022
ffb8f2b
regenerate sample config
H-Shay Jun 9, 2022
2348e47
Merge branch 'develop' into shay/bye_bye_comments
H-Shay Jun 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 9 additions & 77 deletions synapse/config/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,83 +160,15 @@ def generate_config_section(
"Please specify both a cert path and a key path or neither."
)

tls_enabled = "" if tls_certificate_path and tls_private_key_path else "#"

if not tls_certificate_path:
tls_certificate_path = base_key_name + ".tls.crt"
if not tls_private_key_path:
tls_private_key_path = base_key_name + ".tls.key"

# flake8 doesn't recognise that variables are used in the below string
_ = tls_enabled

return (
"""\
## TLS ##

# PEM-encoded X509 certificate for TLS.
# This certificate, as of Synapse 1.0, will need to be a valid and verifiable
# certificate, signed by a recognised Certificate Authority.
#
# Be sure to use a `.pem` file that includes the full certificate chain including
# any intermediate certificates (for instance, if using certbot, use
# `fullchain.pem` as your certificate, not `cert.pem`).
#
%(tls_enabled)stls_certificate_path: "%(tls_certificate_path)s"

# PEM-encoded private key for TLS
#
%(tls_enabled)stls_private_key_path: "%(tls_private_key_path)s"

# Whether to verify TLS server certificates for outbound federation requests.
#
# Defaults to `true`. To disable certificate verification, uncomment the
# following line.
#
#federation_verify_certificates: false

# The minimum TLS version that will be used for outbound federation requests.
#
# Defaults to `1`. Configurable to `1`, `1.1`, `1.2`, or `1.3`. Note
# that setting this value higher than `1.2` will prevent federation to most
# of the public Matrix network: only configure it to `1.3` if you have an
# entirely private federation setup and you can ensure TLS 1.3 support.
#
#federation_client_minimum_tls_version: 1.2

# Skip federation certificate verification on the following whitelist
# of domains.
#
# This setting should only be used in very specific cases, such as
# federation over Tor hidden services and similar. For private networks
# of homeservers, you likely want to use a private CA instead.
#
# Only effective if federation_verify_certicates is `true`.
#
#federation_certificate_verification_whitelist:
# - lon.example.com
# - "*.domain.com"
# - "*.onion"

# List of custom certificate authorities for federation traffic.
#
# This setting should only normally be used within a private network of
# homeservers.
#
# Note that this list will replace those that are provided by your
# operating environment. Certificates must be in PEM format.
#
#federation_custom_ca_list:
# - myCA1.pem
# - myCA2.pem
# - myCA3.pem
"""
# Lowercase the string representation of boolean values
% {
x[0]: str(x[1]).lower() if isinstance(x[1], bool) else x[1]
for x in locals().items()
}
)
if tls_certificate_path and tls_private_key_path:
return (
"""\
tls_certificate_path: "%(tls_certificate_path)s"
tls_private_key_path: "%(tls_private_key_path)s"
"""
% locals())
H-Shay marked this conversation as resolved.
Show resolved Hide resolved
else:
return ""

def read_tls_certificate(self) -> crypto.X509:
"""Reads the TLS certificate from the configured file, and returns it
Expand Down