Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass kwargs to settings #55

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions titiler/pgstac/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Config:


@lru_cache()
def ApiSettings() -> _ApiSettings:
def ApiSettings(**kwargs) -> _ApiSettings:
"""
This function returns a cached instance of the APISettings object.
Caching is used to prevent re-reading the environment every time the API settings are used in an endpoint.
Expand All @@ -35,7 +35,7 @@ def ApiSettings() -> _ApiSettings:

From https://github.com/dmontagu/fastapi-utils/blob/af95ff4a8195caaa9edaa3dbd5b6eeb09691d9c7/fastapi_utils/api_settings.py#L60-L69
"""
return _ApiSettings()
return _ApiSettings(**kwargs)


class _PostgresSettings(pydantic.BaseSettings):
Expand Down Expand Up @@ -78,9 +78,9 @@ def connection_string(self):


@lru_cache()
def PostgresSettings() -> _PostgresSettings:
def PostgresSettings(**kwargs) -> _PostgresSettings:
"""Postgres Settings."""
return _PostgresSettings()
return _PostgresSettings(**kwargs)


class _CacheSettings(pydantic.BaseSettings):
Expand Down Expand Up @@ -111,6 +111,6 @@ def check_enable(cls, values):


@lru_cache()
def CacheSettings() -> _CacheSettings:
def CacheSettings(**kwargs) -> _CacheSettings:
"""Cache settings."""
return _CacheSettings()
return _CacheSettings(**kwargs)