diff options
author | Richard van der Hoff <richard@matrix.org> | 2019-09-26 11:46:14 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2019-09-26 11:46:14 +0100 |
commit | e2de7bbaa036f143164505f0072109c20aee0abb (patch) | |
tree | 22c8b00ec7a9b998885276e98ee6e1d9952156ab | |
parent | Update sample config (diff) | |
download | synapse-e2de7bbaa036f143164505f0072109c20aee0abb.tar.xz |
Review comments and warning formatting
-rw-r--r-- | docs/sample_config.yaml | 9 | ||||
-rw-r--r-- | synapse/config/key.py | 27 | ||||
-rw-r--r-- | synapse/config/server.py | 16 |
3 files changed, 29 insertions, 23 deletions
diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml index 422c25065e..29c7514f32 100644 --- a/docs/sample_config.yaml +++ b/docs/sample_config.yaml @@ -1062,8 +1062,8 @@ signing_key_path: "CONFDIR/SERVERNAME.signing.key" # is still supported for backwards-compatibility, but it is deprecated. # # 'trusted_key_servers' defaults to matrix.org, but using it will generate a -# warning on start up to suppress this warning set 'suppress_key_server_warning' -# to true. +# warning on start-up. To suppress this warning, set +# 'suppress_key_server_warning' to true. # # Options for each entry in the list include: # @@ -1091,9 +1091,12 @@ signing_key_path: "CONFDIR/SERVERNAME.signing.key" # trusted_key_servers: - server_name: "matrix.org" + +# Uncomment the following to disable the warning that is emitted when the +# trusted_key_servers include 'matrix.org'. See above. # #suppress_key_server_warning: true -# + # The signing keys to use when acting as a trusted key server. If not specified # defaults to the server signing key. # diff --git a/synapse/config/key.py b/synapse/config/key.py index 10bb989562..f039f96e9c 100644 --- a/synapse/config/key.py +++ b/synapse/config/key.py @@ -65,7 +65,8 @@ to 'true'. In a future release the software-defined default will be removed entirely and the trusted key server will be defined exclusively by the value of -'trusted_key_servers'.""" +'trusted_key_servers'. +--------------------------------------------------------------------------------""" TRUSTED_KEY_SERVER_CONFIGURED_AS_M_ORG_WARN = """\ This server is configured to use 'matrix.org' as its trusted key server via the @@ -74,7 +75,8 @@ server since it is long-lived, stable and trusted. However, some admins may wish to use another server for this purpose. To suppress this warning and continue using 'matrix.org', admins should set -'suppress_key_server_warning' to 'true' in homeserver.yaml.""" +'suppress_key_server_warning' to 'true' in homeserver.yaml. +--------------------------------------------------------------------------------""" logger = logging.getLogger(__name__) @@ -132,16 +134,14 @@ class KeyConfig(Config): % (type(key_servers).__name__,) ) - for server in key_servers: - if ( - server["server_name"] == "matrix.org" - and not suppress_key_server_warning - ): - logger.warn(TRUSTED_KEY_SERVER_CONFIGURED_AS_M_ORG_WARN) - # merge the 'perspectives' config into the 'trusted_key_servers' config. key_servers.extend(_perspectives_to_key_servers(config)) + if not suppress_key_server_warning and "matrix.org" in ( + s["server_name"] for s in key_servers + ): + logger.warning(TRUSTED_KEY_SERVER_CONFIGURED_AS_M_ORG_WARN) + # list of TrustedKeyServer objects self.key_servers = list( _parse_key_servers(key_servers, self.federation_verify_certificates) @@ -225,8 +225,8 @@ class KeyConfig(Config): # is still supported for backwards-compatibility, but it is deprecated. # # 'trusted_key_servers' defaults to matrix.org, but using it will generate a - # warning on start up to suppress this warning set 'suppress_key_server_warning' - # to true. + # warning on start-up. To suppress this warning, set + # 'suppress_key_server_warning' to true. # # Options for each entry in the list include: # @@ -254,9 +254,12 @@ class KeyConfig(Config): # trusted_key_servers: - server_name: "matrix.org" + + # Uncomment the following to disable the warning that is emitted when the + # trusted_key_servers include 'matrix.org'. See above. # #suppress_key_server_warning: true - # + # The signing keys to use when acting as a trusted key server. If not specified # defaults to the server signing key. # diff --git a/synapse/config/server.py b/synapse/config/server.py index 7f8d315954..a52ce30344 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -48,6 +48,13 @@ ROOM_COMPLEXITY_TOO_GREAT = ( "to join this room." ) +METRICS_PORT_WARNING = """\ +The metrics_port configuration option is deprecated in Synapse 0.31 in favour of +a listener. Please see +https://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.md +on how to configure the new listener. +--------------------------------------------------------------------------------""" + class ServerConfig(Config): def read_config(self, config, **kwargs): @@ -334,14 +341,7 @@ class ServerConfig(Config): metrics_port = config.get("metrics_port") if metrics_port: - logger.warn( - ( - "The metrics_port configuration option is deprecated in Synapse 0.31 " - "in favour of a listener. Please see " - "http://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.md" - " on how to configure the new listener." - ) - ) + logger.warning(METRICS_PORT_WARNING) self.listeners.append( { |