Repository: matrix-org/synapse

Issue:
Self-signed certificate notice is being displayed without the certificate being generated


### Description
The notice about the self signed certificates is being displayed after the configuration file generation although this was removed in #4509 
See: https://github.com/matrix-org/synapse/blob/3bd9daf4b86ed811c9ced95a4adb9aa58b681399/synapse/config/_base.py#L316

<!-- Describe here the problem that you are experiencing -->

### Steps to reproduce

Generate the configuration file

<!-- 
Describe how what happens differs from what you expected.

If you can identify any relevant log snippets from _homeserver.log_, please include
those (please be careful to remove any personal or private data). Please surround them with
``` (three backticks, on a line on their own), so that they are formatted legibly.
-->

### Version information

<!-- IMPORTANT: please answer the following questions, to help us narrow down the problem -->

<!-- Was this issue identified on matrix.org or another homeserver? -->
- **Homeserver**:  local test environment

<!-- 
What version of Synapse is running? 
You can find the Synapse version by inspecting the server headers (replace matrix.org with
your own homeserver domain):
$ curl -v https://matrix.org/_matrix/client/versions 2>&1 | grep "Server:"
-->
- **Version**: `v0.99.0`

- **Install method**: Docker
<!-- examples: package manager/git clone/pip  -->

- **Platform**:  Docker
<!--
Tell us about the environment in which your homeserver is operating
distro, hardware, if it's running in a vm/container, etc.
-->



Discussion:
I think this will be fixed by #4619 
This is not regarding the docker-specific templating. Rather we just used docker to generate a config file, we used 
```bash
python -m synapse.app.homeserver \
    --server-name my.domain.name \
    --config-path homeserver.yaml \
    --generate-config \
    --report-stats=no
```
As described in https://github.com/matrix-org/synapse/blob/master/INSTALL.md
cc @jcgruenhage 
in that case, can you give more details about the repro steps and what symptoms you actually see? 

```bash
jcgruenhage  ~  docker run -it --rm --entrypoint /bin/sh docker.io/matrixdotorg/synapse
/ # python -m synapse.app.homeserver \
>     --server-name my.domain.name \
>     --config-path homeserver.yaml \
>     --generate-config \
>     --report-stats=no
A config file has been generated in 'homeserver.yaml' for server name 'my.domain.name' with corresponding SSL keys and self-signed certificates. Please review this file and customise it to your needs.
If this server name is incorrect, you will need to regenerate the SSL certificates
```
We just used docker to get a throwaway env with a synapse install quickly.
We ran a shell in the container, in which we used synapses good old --generate-config option to generate a config file.
As you can see, after the file was generated, we got a notice about a self signed certificate being created, which is not the case though.
Right, the warning we are complaining about is this one:

```
 jcgruenhage  ~  docker run -it --rm --entrypoint /bin/sh docker.io/matrixdotorg/synapse
/ # python -m synapse.app.homeserver \
>     --server-name my.domain.name \
>     --config-path homeserver.yaml \
>     --generate-config \
>     --report-stats=no
A config file has been generated in 'homeserver.yaml' for server name 'my.domain.name' with corresponding SSL keys and self-signed certificates. Please review this file and customise it to your needs.
If this server name is incorrect, you will need to regenerate the SSL certificates
```

Resolving patch:
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -257,7 +257,7 @@ def load_or_generate_config(cls, description, argv):
             "--keys-directory",
             metavar="DIRECTORY",
             help="Used with 'generate-*' options to specify where files such as"
-            " certs and signing keys should be stored in, unless explicitly"
+            " signing keys should be stored, unless explicitly"
             " specified in the config.",
         )
         config_parser.add_argument(
@@ -313,16 +313,11 @@ def load_or_generate_config(cls, description, argv):
                 print(
                     (
                         "A config file has been generated in %r for server name"
-                        " %r with corresponding SSL keys and self-signed"
-                        " certificates. Please review this file and customise it"
+                        " %r. Please review this file and customise it"
                         " to your needs."
                     )
                     % (config_path, server_name)
                 )
-                print(
-                    "If this server name is incorrect, you will need to"
-                    " regenerate the SSL certificates"
-                )
                 return
             else:
                 print(


Test patch: