Add postgres db (messy)

This commit is contained in:
phil 2025-02-17 02:42:38 +01:00
parent 4008036bca
commit fb433e27be
9 changed files with 257 additions and 111 deletions
src/oidc_test

View file

@ -86,6 +86,27 @@ class Insecure(BaseModel):
skip_verify_signature: bool = False
class DB(BaseModel):
host: str = "localhost"
port: int = 5432
db: str = "oidc-test"
user: str = "oidc-test"
password: str = "oidc-test"
debug: bool = False
pool_size: int = 10
max_overflow: int = 10
echo: bool = False
@property
def sqla_url(self):
return (
f"postgresql+asyncpg://{self.user}:{self.password}@{self.host}:{self.port}/{self.db}"
)
def get_pg_url(self):
return f"postgresql://{self.user}:{self.password}@{self.host}:{self.port}/{self.db}"
class Settings(BaseSettings):
"""Settings wil be read from an .env file"""
@ -96,6 +117,7 @@ class Settings(BaseSettings):
secret_key: str = "".join(random.choice(string.ascii_letters) for _ in range(16))
log: bool = False
insecure: Insecure = Insecure()
db: DB = DB()
cors_origins: list[str] = []
debug_token: bool = False
show_token: bool = False