This commit is contained in:
dderbentsov
2023-07-13 02:14:21 +03:00
parent bc339cefb9
commit 322f14c096
7 changed files with 86 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
from functools import lru_cache
from typing import Optional
from os import getenv
from pydantic import BaseSettings, PostgresDsn
class Settings(BaseSettings):
@@ -11,5 +11,23 @@ def get_settings() -> Settings:
settings = Settings() # type: ignore
print('333333333333333333333333333333333333333333')
print(settings)
print(getenv("POSTGRES_DB"))
if (db := getenv("POSTGRES_DB")) is not None:
# settings.database_url = PostgresDsn.build(
# scheme="postgresql",
# user=settings.database_url.user,
# password=settings.database_url.password,
# host=settings.database_url.host,
# port=settings.database_url.port,
# path=f"/{db}",
# )
settings.database_url = PostgresDsn.build(
scheme="postgresql",
user='barbie',
password='redStar4,1',
host='localhost',
port='5432',
path=f"/{db}",
)
#CONTINUE
return settings