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

hash_password: raise an error if no config file is specified #12789

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 returns an exception when it is called without specifying a config file.
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
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