Apply startup flags that must take effect before core imports. Args: argv: Command-line arguments excluding the executable name.
(argv: list[str])
| 14 | |
| 15 | |
| 16 | def _apply_startup_env_flags(argv: list[str]) -> None: |
| 17 | """Apply startup flags that must take effect before core imports. |
| 18 | |
| 19 | Args: |
| 20 | argv: Command-line arguments excluding the executable name. |
| 21 | """ |
| 22 | |
| 23 | if "-h" in argv or "--help" in argv: |
| 24 | return |
| 25 | |
| 26 | startup_parser = argparse.ArgumentParser(add_help=False) |
| 27 | startup_parser.add_argument("--reset-password", action="store_true") |
| 28 | startup_args, _ = startup_parser.parse_known_args(argv) |
| 29 | if startup_args.reset_password: |
| 30 | os.environ[DASHBOARD_RESET_PASSWORD_ENV] = "1" |
| 31 | |
| 32 | |
| 33 | _apply_startup_env_flags(sys.argv[1:]) |
no outgoing calls