hide --gradio-auth and --api-auth values from /internal/sysinfo report

This commit is contained in:
AUTOMATIC1111 2023-08-27 20:16:50 +03:00
parent 63d3150dc4
commit 896fde789e
1 changed files with 17 additions and 1 deletions

View File

@ -82,7 +82,7 @@ def get_dict():
"Data path": paths_internal.data_path, "Data path": paths_internal.data_path,
"Extensions dir": paths_internal.extensions_dir, "Extensions dir": paths_internal.extensions_dir,
"Checksum": checksum_token, "Checksum": checksum_token,
"Commandline": sys.argv, "Commandline": get_argv(),
"Torch env info": get_torch_sysinfo(), "Torch env info": get_torch_sysinfo(),
"Exceptions": get_exceptions(), "Exceptions": get_exceptions(),
"CPU": { "CPU": {
@ -123,6 +123,22 @@ def get_environment():
return {k: os.environ[k] for k in sorted(os.environ) if k in environment_whitelist} return {k: os.environ[k] for k in sorted(os.environ) if k in environment_whitelist}
def get_argv():
res = []
for v in sys.argv:
if shared.cmd_opts.gradio_auth and shared.cmd_opts.gradio_auth == v:
res.append("<hidden>")
continue
if shared.cmd_opts.api_auth and shared.cmd_opts.api_auth == v:
res.append("<hidden>")
continue
res.append(v)
return res
re_newline = re.compile(r"\r*\n") re_newline = re.compile(r"\r*\n")