0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-21 00:53:55 +01:00

turn --disable-registration into --enable-registration, given the default is for registration to be disabled by default now. this is backwards incompatible by removing the old --disable-registration arg, but makes for a much more intuitive arg

This commit is contained in:
Matthew Hodgson 2015-03-30 12:01:09 -04:00
parent 3e420aebd8
commit 8366fde82f

View file

@ -25,11 +25,11 @@ class RegistrationConfig(Config):
def __init__(self, args): def __init__(self, args):
super(RegistrationConfig, self).__init__(args) super(RegistrationConfig, self).__init__(args)
# `args.disable_registration` may either be a bool or a string depending # `args.enable_registration` may either be a bool or a string depending
# on if the option was given a value (e.g. --disable-registration=false # on if the option was given a value (e.g. --enable-registration=true
# would set `args.disable_registration` to "false" not False.) # would set `args.enable_registration` to "true" not True.)
self.disable_registration = bool( self.disable_registration = not bool(
distutils.util.strtobool(str(args.disable_registration)) distutils.util.strtobool(str(args.enable_registration))
) )
self.registration_shared_secret = args.registration_shared_secret self.registration_shared_secret = args.registration_shared_secret
@ -39,11 +39,11 @@ class RegistrationConfig(Config):
reg_group = parser.add_argument_group("registration") reg_group = parser.add_argument_group("registration")
reg_group.add_argument( reg_group.add_argument(
"--disable-registration", "--enable-registration",
const=True, const=False,
default=True, default=False,
nargs='?', nargs='?',
help="Disable registration of new users.", help="Enable registration for new users.",
) )
reg_group.add_argument( reg_group.add_argument(
"--registration-shared-secret", type=str, "--registration-shared-secret", type=str,
@ -53,8 +53,8 @@ class RegistrationConfig(Config):
@classmethod @classmethod
def generate_config(cls, args, config_dir_path): def generate_config(cls, args, config_dir_path):
if args.disable_registration is None: if args.enable_registration is None:
args.disable_registration = True args.enable_registration = False
if args.registration_shared_secret is None: if args.registration_shared_secret is None:
args.registration_shared_secret = random_string_with_symbols(50) args.registration_shared_secret = random_string_with_symbols(50)