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

Commit f16ec05

Browse files
authored
hash_password: raise an error if no config file is specified (#12789)
1 parent b935c95 commit f16ec05

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

changelog.d/12789.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The `hash_password` script now fails when it is called without specifying a config file.

synapse/_scripts/hash_password.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ def main() -> None:
4646
"Path to server config file. "
4747
"Used to read in bcrypt_rounds and password_pepper."
4848
),
49+
required=True,
4950
)
5051

5152
args = parser.parse_args()
52-
if "config" in args and args.config:
53-
config = yaml.safe_load(args.config)
54-
bcrypt_rounds = config.get("bcrypt_rounds", bcrypt_rounds)
55-
password_config = config.get("password_config", None) or {}
56-
password_pepper = password_config.get("pepper", password_pepper)
53+
config = yaml.safe_load(args.config)
54+
bcrypt_rounds = config.get("bcrypt_rounds", bcrypt_rounds)
55+
password_config = config.get("password_config", None) or {}
56+
password_pepper = password_config.get("pepper", password_pepper)
5757
password = args.password
5858

5959
if not password:

0 commit comments

Comments
 (0)