Skip to content

Commit

Permalink
make api version configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
nonnontrivial committed May 4, 2024
1 parent 36148cf commit cc3295c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.venv
.pytest_cache
data
api/data
7 changes: 5 additions & 2 deletions api/api/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataclasses import dataclass, asdict
import os

from fastapi import FastAPI, HTTPException, APIRouter

Expand All @@ -8,13 +9,15 @@
predict_sky_brightness,
)

api_version = os.getenv("API_VERSION", "v1")

app = FastAPI()
main_router = APIRouter(prefix="/api/v1")
main_router = APIRouter(prefix=f"/api/{api_version}")


@dataclass
class PredictionResponse:
# magnitudes per square arcsecond
"""carries sky brightness in mpsas"""
sky_brightness: float


Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ services:
build: ./api
ports:
- "8000:8000"
environment:
API_VERSION: "v1"
rabbitmq:
image: "rabbitmq:management"
ports:
Expand Down

0 comments on commit cc3295c

Please sign in to comment.