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

Commit 254f449

Browse files
committed
Remove passwords when logging the conf details. Fix typos.
1 parent 7367c88 commit 254f449

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Reasons to use a configuration file:
211211

212212
- Convenience - Set-up the parameters for diffs that need to run often
213213

214-
- Easier and more readible - You can define the database connection settings as config values, instead of in a URI.
214+
- Easier and more readable - you can define the database connection settings as config values, instead of in a URI.
215215

216216
- Gives you fine-grained control over the settings switches, without requiring any Python code.
217217

data_diff/__main__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from copy import deepcopy
12
import sys
23
import time
34
import json
@@ -25,6 +26,13 @@
2526
"-": "red",
2627
}
2728

29+
def _remove_passwords_in_dict(d: dict):
30+
for k, v in d.items():
31+
if k == 'password':
32+
d[k] = '*' * len(v)
33+
elif isinstance(v, dict):
34+
_remove_passwords_in_dict(v)
35+
2836

2937
@click.command()
3038
@click.argument("database1", required=False)
@@ -110,6 +118,8 @@ def _main(
110118
if debug:
111119
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT, datefmt=DATE_FORMAT)
112120
if __conf__:
121+
__conf__ = deepcopy(__conf__)
122+
_remove_passwords_in_dict(__conf__)
113123
logging.debug(f"Applied run configuration: {__conf__}")
114124
elif verbose:
115125
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT, datefmt=DATE_FORMAT)

0 commit comments

Comments
 (0)