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

Commit

Permalink
hash_password: raise an error if no config file is specified (#12789)
Browse files Browse the repository at this point in the history
  • Loading branch information
jae1911 authored May 19, 2022
1 parent b935c95 commit f16ec05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/12789.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `hash_password` script now fails when it is called without specifying a config file.
10 changes: 5 additions & 5 deletions synapse/_scripts/hash_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def main() -> None:
"Path to server config file. "
"Used to read in bcrypt_rounds and password_pepper."
),
required=True,
)

args = parser.parse_args()
if "config" in args and args.config:
config = yaml.safe_load(args.config)
bcrypt_rounds = config.get("bcrypt_rounds", bcrypt_rounds)
password_config = config.get("password_config", None) or {}
password_pepper = password_config.get("pepper", password_pepper)
config = yaml.safe_load(args.config)
bcrypt_rounds = config.get("bcrypt_rounds", bcrypt_rounds)
password_config = config.get("password_config", None) or {}
password_pepper = password_config.get("pepper", password_pepper)
password = args.password

if not password:
Expand Down

0 comments on commit f16ec05

Please sign in to comment.