mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 06:23:28 +00:00
App Settings
This commit is contained in:
parent
37f3bce194
commit
234705d099
|
@ -9,3 +9,8 @@ API_HOST=0.0.0.0
|
||||||
API_PORT=8000
|
API_PORT=8000
|
||||||
|
|
||||||
JWT_SECRET_KEY=v9LctjUWwol4XbvczPiLFMDtZ8aal7mm
|
JWT_SECRET_KEY=v9LctjUWwol4XbvczPiLFMDtZ8aal7mm
|
||||||
|
|
||||||
|
APP_TITLE=FastAPI
|
||||||
|
APP_VERSION=0.1.0
|
||||||
|
APP_DOCS_URL=/api/openapi
|
||||||
|
APP_OPENAPI_URL=/api/openapi.json
|
||||||
|
|
|
@ -61,10 +61,10 @@ class Application:
|
||||||
|
|
||||||
def create_app(self) -> fastapi.FastAPI:
|
def create_app(self) -> fastapi.FastAPI:
|
||||||
app = fastapi.FastAPI(
|
app = fastapi.FastAPI(
|
||||||
title="FastAPI",
|
title=self.settings.app.title,
|
||||||
version="0.1.0",
|
version=self.settings.app.version,
|
||||||
docs_url="/api/openapi",
|
docs_url=self.settings.app.docs_url,
|
||||||
openapi_url="/api/openapi.json",
|
openapi_url=self.settings.app.openapi_url,
|
||||||
default_response_class=fastapi.responses.ORJSONResponse,
|
default_response_class=fastapi.responses.ORJSONResponse,
|
||||||
lifespan=self.lifespan,
|
lifespan=self.lifespan,
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import lib.app.split_settings as app_split_settings
|
||||||
|
|
||||||
class Settings(pydantic_settings.BaseSettings):
|
class Settings(pydantic_settings.BaseSettings):
|
||||||
api: app_split_settings.ApiSettings = pydantic.Field(default_factory=lambda: app_split_settings.ApiSettings())
|
api: app_split_settings.ApiSettings = pydantic.Field(default_factory=lambda: app_split_settings.ApiSettings())
|
||||||
|
app: app_split_settings.AppSettings = pydantic.Field(default_factory=lambda: app_split_settings.AppSettings())
|
||||||
postgres: app_split_settings.PostgresSettings = pydantic.Field(
|
postgres: app_split_settings.PostgresSettings = pydantic.Field(
|
||||||
default_factory=lambda: app_split_settings.PostgresSettings()
|
default_factory=lambda: app_split_settings.PostgresSettings()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
from .api import *
|
from .api import *
|
||||||
|
from .app import *
|
||||||
from .logger import *
|
from .logger import *
|
||||||
from .postgres import *
|
from .postgres import *
|
||||||
from .project import *
|
from .project import *
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"ApiSettings",
|
"ApiSettings",
|
||||||
|
"AppSettings",
|
||||||
"LoggingSettings",
|
"LoggingSettings",
|
||||||
"PostgresSettings",
|
"PostgresSettings",
|
||||||
"ProjectSettings",
|
"ProjectSettings",
|
||||||
|
|
17
src/fastapi_app/lib/app/split_settings/app.py
Normal file
17
src/fastapi_app/lib/app/split_settings/app.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import pydantic_settings
|
||||||
|
|
||||||
|
import lib.app.split_settings.utils as app_split_settings_utils
|
||||||
|
|
||||||
|
|
||||||
|
class AppSettings(pydantic_settings.BaseSettings):
|
||||||
|
model_config = pydantic_settings.SettingsConfigDict(
|
||||||
|
env_file=app_split_settings_utils.ENV_PATH,
|
||||||
|
env_prefix="APP_",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
extra="ignore",
|
||||||
|
)
|
||||||
|
|
||||||
|
title: str = "FastAPI"
|
||||||
|
version: str = "0.1.0"
|
||||||
|
docs_url: str = "/api/openapi"
|
||||||
|
openapi_url: str = "/api/openapi.json"
|
Loading…
Reference in New Issue
Block a user