我试图禁用 Swagger UI,或更准确地说,因为我希望我们仅为非产品环境提供它。
我引用了THIS链接,但是什么也没发生。
我的
api_platform.yaml
文件:
api_platform:
defaults:
route_prefix: '/%env(API_ROUTE)%'
enable_docs: false
enable_entrypoint: false
enable_swagger_ui: false
swagger:
api_keys:
JWT:
name: Authorization
type: header
collection:
pagination:
enabled: true
api_platform:
defaults:
route_prefix: '/%env(API_ROUTE)%'
swagger:
api_keys:
JWT:
name: Authorization
type: header
collection:
pagination:
enabled: true
when@prod:
api_platform:
enable_docs: false
enable_entrypoint: false
enable_swagger_ui: false
您的 api_platform.yaml 看起来像这样。那么,如果您正确使用环境,则仅在您的产品环境中禁用您的招摇。