summary refs log tree commit diff
path: root/synapse/config/registration.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-12-21 16:04:57 +0100
committerAmber Brown <hawkowl@atleastfornow.net>2018-12-22 02:04:57 +1100
commit9c2af7b2c51e31a1baf5ef523a251b946774468c (patch)
tree6c5fe1adda3c4728c36313de4fcfd53699ab2779 /synapse/config/registration.py
parentFix indentation in default config (#4313) (diff)
downloadsynapse-9c2af7b2c51e31a1baf5ef523a251b946774468c.tar.xz
Add a script to generate a clean config file (#4315)
Diffstat (limited to 'synapse/config/registration.py')
-rw-r--r--synapse/config/registration.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py
index e365f0c30b..6c2b543b8c 100644
--- a/synapse/config/registration.py
+++ b/synapse/config/registration.py
@@ -50,8 +50,13 @@ class RegistrationConfig(Config):
                 raise ConfigError('Invalid auto_join_rooms entry %s' % (room_alias,))
         self.autocreate_auto_join_rooms = config.get("autocreate_auto_join_rooms", True)
 
-    def default_config(self, **kwargs):
-        registration_shared_secret = random_string_with_symbols(50)
+    def default_config(self, generate_secrets=False, **kwargs):
+        if generate_secrets:
+            registration_shared_secret = 'registration_shared_secret: "%s"' % (
+                random_string_with_symbols(50),
+            )
+        else:
+            registration_shared_secret = '# registration_shared_secret: <PRIVATE STRING>'
 
         return """\
         ## Registration ##
@@ -78,7 +83,7 @@ class RegistrationConfig(Config):
 
         # If set, allows registration by anyone who also has the shared
         # secret, even if registration is otherwise disabled.
-        registration_shared_secret: "%(registration_shared_secret)s"
+        %(registration_shared_secret)s
 
         # Set the number of bcrypt rounds used to generate password hash.
         # Larger numbers increase the work factor needed to generate the hash.