11from functools import cached_property
2+ from typing import Annotated
23from urllib .parse import parse_qsl , urlencode , urlparse , urlunparse
34
45from pydantic import (
@@ -25,26 +26,28 @@ class PostgresSettings(BaseCustomSettings):
2526 POSTGRES_PASSWORD : SecretStr
2627
2728 # database
28- POSTGRES_DB : str = Field (..., description = "Database name" )
29+ POSTGRES_DB : Annotated [ str , Field (description = "Database name" )]
2930
3031 # pool connection limits
31- POSTGRES_MINSIZE : int = Field (
32- default = 1 , description = "Minimum number of connections in the pool" , ge = 1
33- )
34- POSTGRES_MAXSIZE : int = Field (
35- default = 50 , description = "Maximum number of connections in the pool" , ge = 1
36- )
32+ POSTGRES_MINSIZE : Annotated [
33+ int , Field ( description = "Minimum number of connections in the pool" , ge = 1 )
34+ ] = 1
35+ POSTGRES_MAXSIZE : Annotated [
36+ int , Field ( description = "Maximum number of connections in the pool" , ge = 1 )
37+ ] = 50
3738
38- POSTGRES_CLIENT_NAME : str | None = Field (
39- default = None ,
40- description = "Name of the application connecting the postgres database, will default to use the host hostname (hostname on linux)" ,
41- validation_alias = AliasChoices (
42- "POSTGRES_CLIENT_NAME" ,
43- # This is useful when running inside a docker container, then the hostname is set each client gets a different name
44- "HOST" ,
45- "HOSTNAME" ,
39+ POSTGRES_CLIENT_NAME : Annotated [
40+ str | None ,
41+ Field (
42+ description = "Name of the application connecting the postgres database, will default to use the host hostname (hostname on linux)" ,
43+ validation_alias = AliasChoices (
44+ "POSTGRES_CLIENT_NAME" ,
45+ # This is useful when running inside a docker container, then the hostname is set each client gets a different name
46+ "HOST" ,
47+ "HOSTNAME" ,
48+ ),
4649 ),
47- )
50+ ] = None
4851
4952 @field_validator ("POSTGRES_MAXSIZE" )
5053 @classmethod
0 commit comments