I made a minor error in the last push, so am pushing this again.

Config file changes
This file can now be pushed to the main branch. The following changes have taken place:
1) Removed my personal data.
2) Made it compliant with pydantic 2. This involved:
    a) Changing the way of noting optional strings (now 'none' strings). This is as elegant as is possible.
    b) Updating the imports. Origin code results in "pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.7/migration/#basesettings-has-moved-to-pydantic-settings for more details.
    c) converting urls using the str() method. Origin code results in AttributeError: 'pydantic_core._pydantic_core.Url' object has no attribute 'decode' For further information visit https://errors.pydantic.dev/2.7/u/import-error"

New developers will still need to fill out the mail_address, mail_password, mail_username, mail_port and secret_key before they can run the code. This is by design, though.
This commit is contained in:
BogPlaymate
2024-07-09 18:01:44 +09:00
parent d7a39513f6
commit 65cbcf2282
+6 -6
View File
@@ -35,12 +35,12 @@ class Settings(BaseSettings):
db_url: str | PostgresDsn = "postgresql://postgres:mysecretpassword@localhost:5432/classquiz"
hcaptcha_key: str | None = None
recaptcha_key: str | None = None
mail_address: str | None = None #from here
mail_password: str | None = None
mail_username: str | None = None
mail_server: str | None = None
mail_port: int | None = None
secret_key: str = "secretkey" # to here
mail_address: str
mail_password: str
mail_username: str
mail_server: str
mail_port: int
secret_key: str
access_token_expire_minutes: int = 30
cache_expiry: int = 86400
sentry_dsn: str | None = None