config.py 465 B

123456789101112131415161718192021
  1. from pathlib import Path
  2. import typer
  3. def get_config_folder() -> Path:
  4. return Path(typer.get_app_dir("fastapi-cli"))
  5. def get_auth_path() -> Path:
  6. auth_path = get_config_folder() / "auth.json"
  7. auth_path.parent.mkdir(parents=True, exist_ok=True)
  8. return auth_path
  9. def get_cli_config_path() -> Path:
  10. cli_config_path = get_config_folder() / "cli.json"
  11. cli_config_path.parent.mkdir(parents=True, exist_ok=True)
  12. return cli_config_path