44import os
55
66
7- class MailSettings (BaseSettings ):
8- username : str = Field (default = "username" ,
9- description = "Mail service username" ,
10- alias = AliasChoices ("MAIL__USERNAME" ))
11- password : str = Field (default = "password" ,
12- description = "Mail service password" ,
13- alias = AliasChoices ("MAIL__PASSWORD" ))
14- from_mail : str = Field (
15- default = "from@example.com" ,
16- description = "Email address used in the 'From' header" ,
17- alias = AliasChoices ("MAIL__FROM" )
18- )
19- port : int = Field (
20- default = 587 ,
21- description = "Mail service port" ,
22- alias = AliasChoices ("MAIL__PORT" )
23- )
24- server : str = Field (
25- default = "smtp.example.com" ,
26- description = "Mail service SMTP server" ,
27- alias = AliasChoices ("MAIL__SERVER" )
28- )
29- from_name : str = Field (
30- default = "Example Service" ,
31- description = "Name used in the 'From' header" ,
32- alias = AliasChoices ("MAIL__FROM_NAME" )
33- )
34- send_mails : bool = True
7+ # class MailSettings(BaseSettings):
8+ # username: str = Field(default="username",
9+ # description="Mail service username",
10+ # alias=AliasChoices("MAIL__USERNAME"))
11+ # password: str = Field(default="password",
12+ # description="Mail service password",
13+ # alias=AliasChoices("MAIL__PASSWORD"))
14+ # from_mail: str = Field(
15+ # default="from@example.com",
16+ # description="Email address used in the 'From' header",
17+ # alias=AliasChoices("MAIL__FROM")
18+ # )
19+ # port: int = Field(
20+ # default=587,
21+ # description="Mail service port",
22+ # alias=AliasChoices("MAIL__PORT")
23+ # )
24+ # server: str = Field(
25+ # default="smtp.example.com",
26+ # description="Mail service SMTP server",
27+ # alias=AliasChoices("MAIL__SERVER")
28+ # )
29+ # from_name: str = Field(
30+ # default="Example Service",
31+ # description="Name used in the 'From' header",
32+ # alias=AliasChoices("MAIL__FROM_NAME")
33+ # )
34+ # send_mails: bool = True
3535
3636
37- class DatabaseSettings (BaseSettings ):
38- url : str = Field (...,
39- description = "Database connection URL" ,
40- alias = AliasChoices ("DATABASE__URL" ))
37+ # class DatabaseSettings(BaseSettings):
38+ # url: str = Field(...,
39+ # description="Database connection URL",
40+ # alias=AliasChoices("DATABASE__URL"))
4141
4242
43- class ClientSettings (BaseSettings ):
44- url : str = Field (...,
45- description = "Mail service URL" ,
46- alias = AliasChoices ("CLIENTS__MAIL_CLIENT__URL" ))
43+ # class ClientSettings(BaseSettings):
44+ # url: str = Field(...,
45+ # description="Mail service URL",
46+ # alias=AliasChoices("CLIENTS__MAIL_CLIENT__URL"))
4747
4848
4949class Settings (BaseSettings ):
@@ -54,6 +54,9 @@ class Settings(BaseSettings):
5454 extra = "ignore" )
5555
5656 # General settings
57+ url : str = Field (...,
58+ description = "Database connection URL" ,
59+ alias = AliasChoices ("DATABASE__URL" ))
5760 front_url : str = Field (
5861 default = "https://frontend.integration.lleidahack.dev/hackeps" ,
5962 description = "Frontend URL" ,
@@ -71,21 +74,50 @@ class Settings(BaseSettings):
7174 default = "src/templates/emails/initial.html" ,
7275 description = "Path to the initial email template" ,
7376 alias = AliasChoices ("INITIAL_TEMPLATES_PATH" ))
74-
77+ username : str = Field (default = "username" ,
78+ description = "Mail service username" ,
79+ alias = AliasChoices ("MAIL__USERNAME" ))
80+ password : str = Field (default = "password" ,
81+ description = "Mail service password" ,
82+ alias = AliasChoices ("MAIL__PASSWORD" ))
83+ from_mail : str = Field (
84+ default = "from@example.com" ,
85+ description = "Email address used in the 'From' header" ,
86+ alias = AliasChoices ("MAIL__FROM" )
87+ )
88+ port : int = Field (
89+ default = 587 ,
90+ description = "Mail service port" ,
91+ alias = AliasChoices ("MAIL__PORT" )
92+ )
93+ server : str = Field (
94+ default = "smtp.example.com" ,
95+ description = "Mail service SMTP server" ,
96+ alias = AliasChoices ("MAIL__SERVER" )
97+ )
98+ from_name : str = Field (
99+ default = "Example Service" ,
100+ description = "Name used in the 'From' header" ,
101+ alias = AliasChoices ("MAIL__FROM_NAME" )
102+ )
103+ url : str = Field (...,
104+ description = "Mail service URL" ,
105+ alias = AliasChoices ("CLIENTS__MAIL_CLIENT__URL" ))
106+ send_mails : bool = True
75107 # Nested settings
76108
77- database : DatabaseSettings
78- mail : MailSettings
79- clients : ClientSettings
109+ # database: DatabaseSettings
110+ # mail: MailSettings
111+ # clients: ClientSettings
80112
81113 def __init__ (self , ** kwargs ):
82114 # Handle environment-specific defaults
83115 # env = os.environ.get('ENV', 'main')
84116
85117 super ().__init__ (** kwargs )
86- self .databse = DatabaseSettings ()
87- self .mail = MailSettings ()
88- self .clients = ClientSettings ()
118+ # self.databse=DatabaseSettings()
119+ # self.mail=MailSettings()
120+ # self.clients=ClientSettings()
89121
90122
91123# Global settings instance
0 commit comments