diff --git a/README.md b/README.md index 0e0c622..48d252d 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,6 @@ from microbootstrap import LitestarSettings class YourSettings(LitestarSettings): # General settings - service_debug: bool = False service_name: str = "my-awesome-service" # Sentry settings @@ -140,7 +139,6 @@ Example: ```python class YourSettings(BaseServiceSettings): - service_debug: bool = True service_name: str = "micro-service" your_awesome_parameter: str = "really awesome" @@ -171,7 +169,6 @@ from microbootstrap.settings import BaseServiceSettings class ServiceSettings(BaseServiceSettings): - service_debug: bool = True service_environment: str | None = None service_name: str = "micro-service" service_description: str = "Micro service description" @@ -325,7 +322,7 @@ These settings are subsequently passed to [opentelemetry](https://opentelemetry. microbootstrap provides in-memory JSON logging through the use of [structlog](https://pypi.org/project/structlog/). For more information on in-memory logging, refer to [MemoryHandler](https://docs.python.org/3/library/logging.handlers.html#memoryhandler). -To utilize this feature, your application must be in non-debug mode, meaning `service_debug` should be set to `False`. +To utilize this feature, your application must be in non-debug mode, meaning `service_debug` should be set to `False`, which is the default. ```python import logging diff --git a/microbootstrap/instruments/swagger_instrument.py b/microbootstrap/instruments/swagger_instrument.py index c0d4a45..d53c1e5 100644 --- a/microbootstrap/instruments/swagger_instrument.py +++ b/microbootstrap/instruments/swagger_instrument.py @@ -14,7 +14,7 @@ class SwaggerConfig(BaseInstrumentConfig): service_static_path: str = "/static" swagger_path: str = "/docs" - swagger_offline_docs: bool = False + swagger_offline_docs: bool = True swagger_extra_params: dict[str, typing.Any] = pydantic.Field(default_factory=dict) diff --git a/microbootstrap/settings.py b/microbootstrap/settings.py index 0636e9a..a0a850b 100644 --- a/microbootstrap/settings.py +++ b/microbootstrap/settings.py @@ -25,7 +25,7 @@ class BaseServiceSettings( pydantic_settings.BaseSettings, ): - service_debug: bool = True + service_debug: bool = False service_environment: str | None = None service_name: str = pydantic.Field( "micro-service", validation_alias=pydantic.AliasChoices("SERVICE_NAME", f"{ENV_PREFIX}SERVICE_NAME") @@ -38,7 +38,7 @@ class BaseServiceSettings( server_host: str = "0.0.0.0" # noqa: S104 server_port: int = 8000 - server_reload: bool = True + server_reload: bool = False server_workers_count: int = 1 model_config = pydantic_settings.SettingsConfigDict( diff --git a/tests/instruments/test_swagger.py b/tests/instruments/test_swagger.py index 691c1ed..5123d3a 100644 --- a/tests/instruments/test_swagger.py +++ b/tests/instruments/test_swagger.py @@ -39,6 +39,7 @@ def test_swagger_teardown( def test_litestar_swagger_bootstrap_online_docs(minimal_swagger_config: SwaggerConfig) -> None: + minimal_swagger_config.swagger_offline_docs = False swagger_instrument: typing.Final = LitestarSwaggerInstrument(minimal_swagger_config) swagger_instrument.bootstrap() @@ -52,7 +53,6 @@ def test_litestar_swagger_bootstrap_online_docs(minimal_swagger_config: SwaggerC def test_litestar_swagger_bootstrap_offline_docs(minimal_swagger_config: SwaggerConfig) -> None: - minimal_swagger_config.swagger_offline_docs = True swagger_instrument: typing.Final = LitestarSwaggerInstrument(minimal_swagger_config) swagger_instrument.bootstrap() @@ -72,6 +72,7 @@ async def test_litestar_swagger_bootstrap_working_online_docs( minimal_swagger_config: SwaggerConfig, ) -> None: minimal_swagger_config.swagger_path = "/my-docs-path" + minimal_swagger_config.swagger_offline_docs = False swagger_instrument: typing.Final = LitestarSwaggerInstrument(minimal_swagger_config) swagger_instrument.bootstrap() @@ -88,7 +89,6 @@ async def test_litestar_swagger_bootstrap_working_offline_docs( minimal_swagger_config: SwaggerConfig, ) -> None: minimal_swagger_config.service_static_path = "/my-static-path" - minimal_swagger_config.swagger_offline_docs = True swagger_instrument: typing.Final = LitestarSwaggerInstrument(minimal_swagger_config) swagger_instrument.bootstrap() @@ -116,6 +116,7 @@ async def test_fastapi_swagger_bootstrap_working_online_docs( minimal_swagger_config: SwaggerConfig, ) -> None: minimal_swagger_config.swagger_path = "/my-docs-path" + minimal_swagger_config.swagger_offline_docs = False swagger_instrument: typing.Final = FastApiSwaggerInstrument(minimal_swagger_config) swagger_instrument.bootstrap() @@ -132,7 +133,6 @@ async def test_fastapi_swagger_bootstrap_working_offline_docs( minimal_swagger_config: SwaggerConfig, ) -> None: minimal_swagger_config.service_static_path = "/my-static-path" - minimal_swagger_config.swagger_offline_docs = True swagger_instrument: typing.Final = FastApiSwaggerInstrument(minimal_swagger_config) fastapi_application = fastapi.FastAPI( **swagger_instrument.bootstrap_before(),