From 6a8adf633eade6d962dfa871a096a1d92a12b5ab Mon Sep 17 00:00:00 2001 From: reqww Date: Tue, 6 Aug 2024 15:25:30 +0300 Subject: [PATCH] Add TOC --- README.md | 70 +++++++++++++++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 547e786..9541e08 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,24 @@ With microbootstrap, you get an application with lightweight built-in sup Interested? Let's jump right into it ⚡ +## Table of contents + +- [Installation](#installation) +- [Quickstart](#quickstart) +- [Settings](#settings) +- [Service settings](#service-settings) +- [Instruments](#instruments) + - [Sentry](#sentry) + - [Prometheus](#prometheus) + - [Opentelemetry](#opentelemetry) + - [Logging](#logging) + - [Cors](#cors) + - [Swagger](#swagger) +- [Configuration](#configuration) + - [Instruments configuration](#instruments-configuration) + - [Application configuration](#application-configuration) +- [Advanced](#advanced) + ## Installation You can install package with `pip` or `poetry`. @@ -283,6 +301,32 @@ Parameters description: - `logging_extra_processors` - set additional structlog processors if you have some. - `logging_exclude_endpoints` - remove logging on certain endpoints. +### Cors + +```python +from microbootstrap.bootstrappers.litestar import BaseBootstrapSettings + + +class YourSettings(BaseBootstrapSettings): + cors_allowed_origins: list[str] = pydantic.Field(default_factory=list) + cors_allowed_methods: list[str] = pydantic.Field(default_factory=list) + cors_allowed_headers: list[str] = pydantic.Field(default_factory=list) + cors_exposed_headers: list[str] = pydantic.Field(default_factory=list) + cors_allowed_credentials: bool = False + cors_allowed_origin_regex: str | None = None + cors_max_age: int = 600 +``` + +Parameters description: + +- `cors_allowed_origins` - list of origins that are allowed. +- `cors_allowed_methods` - list of allowed HTTP methods. +- `cors_allowed_headers` - list of allowed headers. +- `cors_exposed_headers` - list of headers that are exposed via the 'Access-Control-Expose-Headers' header. +- `cors_allowed_credentials` - boolean dictating whether or not to set the 'Access-Control-Allow-Credentials' header. +- `cors_allowed_origin_regex` - regex to match origins against. +- `cors_max_age` - response caching TTL in seconds, defaults to 600. + ### Swagger ```python @@ -310,32 +354,6 @@ Parameters description: - `swagger_offline_docs` - makes swagger js bundles access offline, because service starts to host via static. - `swagger_extra_params` - additional params to pass into openapi config. -### Cors - -```python -from microbootstrap.bootstrappers.litestar import BaseBootstrapSettings - - -class YourSettings(BaseBootstrapSettings): - cors_allowed_origins: list[str] = pydantic.Field(default_factory=list) - cors_allowed_methods: list[str] = pydantic.Field(default_factory=list) - cors_allowed_headers: list[str] = pydantic.Field(default_factory=list) - cors_exposed_headers: list[str] = pydantic.Field(default_factory=list) - cors_allowed_credentials: bool = False - cors_allowed_origin_regex: str | None = None - cors_max_age: int = 600 -``` - -Parameters description: - -- `cors_allowed_origins` - list of origins that are allowed. -- `cors_allowed_methods` - list of allowed HTTP methods. -- `cors_allowed_headers` - list of allowed headers. -- `cors_exposed_headers` - list of headers that are exposed via the 'Access-Control-Expose-Headers' header. -- `cors_allowed_credentials` - boolean dictating whether or not to set the 'Access-Control-Allow-Credentials' header. -- `cors_allowed_origin_regex` - regex to match origins against. -- `cors_max_age` - response caching TTL in seconds, defaults to 600. - ## Configuration Despite settings being pretty convenient mechanism, it's not always possible to store everything in settings. diff --git a/pyproject.toml b/pyproject.toml index 3b243a2..a87b594 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] -version = "0.1.0" +version = "0.2.1" description = "Package for bootstrapping new micro-services" authors = ["community-of-python"] readme = "README.md"