Lightning-AI/LitServe

Feature Request: Customize FastAPI Metadata

Opened this issue · 5 comments

Feature Request: Customize FastAPI Metadata

Description

Add a way to change FastAPI metadata (like title, description, license info, contact details, etc) and control the visibility of documentation URLs through the app_config parameter in LitServer.

Motivation

It would be helpful to easily customize API documentation details and hide docs URLs if needed, to keep things private or more tailored to specific needs.

Proposal

Update LitServer to accept an app_config dictionary for metadata settings:

server = LitServer(..., app_config={
    "title": "Lit API",
    "description": "Lit API Description",
    "license_info": {"name": "MIT", "url": "https://opensource.org/licenses/MIT"},

    # "docs_url": None,  # to Hide docs URL
    ...
})

In server.py, apply these settings to FastAPI:

self.app = FastAPI(lifespan=self.lifespan, **app_config)

Alternatives

Additional Context

Hi @bhimrazy I can take this up

Hi @ankitsharma07,

Thanks for your interest!
Let’s wait to hear feedback from the maintainers first, and once we have their feedback, feel free to proceed.

cc: @aniketmaurya @lantiga

This is something that our team would find useful as well. Is this still being prioritized? @aniketmaurya @lantiga

hi @vrdn-23, could you elaborate the use case if possible?

  • What will this feature enable you to do that you aren't able to do already?
  • Are you blocked because of this?

What will this feature enable you to do that you aren't able to do already?

I think the biggest plus point would be the ability to turn off the documentation url for an application that we are providing as a REST API. We typically have our own generated API docs that are not running on the same server as the application and having an endpoint exposed that we have not explicitly allowed and have no control to turn off, is often flagged as a security issue (related to information disclosure).

Are you blocked because of this?

Nope. Not currently. I do believe however this is a simple enough change that shouldn't add overhead complexity but at the same time provide small wins for people who need this level of configurability.