Add redis (live layers)

Add base for geo_api (WIP)
This commit is contained in:
phil 2023-12-16 00:49:01 +05:30
parent 049b8c9927
commit 4048e61221
11 changed files with 694 additions and 55 deletions

View file

@ -8,8 +8,10 @@ from typing import Any
from fastapi import FastAPI, responses
from .api import api
from .geoapi import api as geoapi
from .config import conf
from .registry import registry, ModelRegistry
from .redis_tools import setup_redis, shutdown_redis, setup_redis_cache
logging.basicConfig(level=conf.gisaf.debugLevel)
@ -28,6 +30,7 @@ class GisafFastAPI(FastAPI):
@asynccontextmanager
async def lifespan(app: FastAPI):
await registry.make_registry(app)
await setup_redis(app)
yield
app = FastAPI(
@ -37,4 +40,6 @@ app = FastAPI(
lifespan=lifespan,
default_response_class=responses.ORJSONResponse,
)
app.mount('/v2', api)
app.mount('/v2', api)
app.mount('/gj', geoapi)