File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -549,11 +549,12 @@ def setup_logging(debug: bool = False) -> None:
549549 # .env import test.
550550 cfg2 = import_from_env (cfg )
551551 print ("After import_from_env (may be no-op):" )
552- # Collect only the NAMES of populated secret fields; the secret values
553- # themselves never flow into the print (avoids clear-text logging).
554- configured = {name for name in _SECRET_FIELDS if getattr (cfg2 , name )}
555- for f_name in sorted (_SECRET_FIELDS ):
556- print (f" { f_name } = { 'set' if f_name in configured else '(empty)' } " )
552+ # Iterate dataclass fields (not the _SECRET_FIELDS literal) and mask secrets;
553+ # the secret value only gates a constant, so it never reaches the print.
554+ for f in fields (AppConfig ):
555+ if f .name in _SECRET_FIELDS :
556+ masked = "***" if getattr (cfg2 , f .name ) else "(empty)"
557+ print (f" { f .name } = { masked } " )
557558
558559 print ()
559560 print ("Config module OK" )
You can’t perform that action at this time.
0 commit comments