Initial extraction from monorepo
This commit is contained in:
commit
5c7baa8acc
20 changed files with 1974 additions and 0 deletions
36
hmrc_sync/__main__.py
Normal file
36
hmrc_sync/__main__.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import click
|
||||
import uvicorn
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli() -> None:
|
||||
logging.basicConfig(level=os.environ.get("LOG_LEVEL", "INFO"))
|
||||
|
||||
|
||||
@cli.command()
|
||||
def serve() -> None:
|
||||
"""Run the FastAPI server (K8s entrypoint)."""
|
||||
uvicorn.run("hmrc_sync.app:app", host="0.0.0.0", port=8080)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("--tax-year", default="current", help="Tax year to fetch, e.g. 2024-25 or 'current'.")
|
||||
def sync(tax_year: str) -> None:
|
||||
"""One-shot sync of HMRC figures — used by the CronJob."""
|
||||
raise click.ClickException("Sync stub — implement after HMRC prod approval lands")
|
||||
|
||||
|
||||
@cli.command()
|
||||
def migrate() -> None:
|
||||
"""Run `alembic upgrade head`."""
|
||||
result = subprocess.run(["alembic", "upgrade", "head"], check=False)
|
||||
sys.exit(result.returncode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
Loading…
Add table
Add a link
Reference in a new issue