Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control default endpoints in titiler.main with env variable #156

Closed
vincentsarago opened this issue Dec 4, 2020 · 0 comments · Fixed by #167
Closed

Control default endpoints in titiler.main with env variable #156

vincentsarago opened this issue Dec 4, 2020 · 0 comments · Fixed by #167
Labels
enhancement New feature or request

Comments

@vincentsarago
Copy link
Member

vincentsarago commented Dec 4, 2020

titiler/titiler/main.py

Lines 29 to 31 in a5744b0

app.include_router(cog.router, prefix="/cog", tags=["Cloud Optimized GeoTIFF"])
app.include_router(stac.router, prefix="/stac", tags=["SpatioTemporal Asset Catalog"])
app.include_router(mosaic.router, prefix="/mosaicjson", tags=["MosaicJSON"])

settings.py

class ApiSettings(pydantic.BaseSettings):
    """FASTAPI application settings."""

    name: str = "titiler"
    cors_origins: str = "*"
    cachecontrol: str = "public, max-age=3600"
    debug: bool = False

    disable_cog: bool = False
    disable_stac: bool = False
    disable_mosaic: bool = False

main.py

...
if not api_settings.disable_cog:
    app.include_router(cog.router, prefix="/cog", tags=["Cloud Optimized GeoTIFF"])
if not api_settings.disable_stac:
    app.include_router(stac.router, prefix="/stac", tags=["SpatioTemporal Asset Catalog"])
if not api_settings.disable_mosaic:
    app.include_router(mosaic.router, prefix="/mosaicjson", tags=["MosaicJSON"])
...

To disable /cog the user will then have to set API_DISABLE_COG=TRUE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant