Committing Everything

This commit is contained in:
BogPlaymate
2024-07-05 19:22:01 +09:00
committed by Mawoka
parent 2bfd73412d
commit 4d6e919d77
28 changed files with 2297 additions and 89 deletions
+22 -19
View File
@@ -7,7 +7,8 @@ from functools import lru_cache
from redis import asyncio as redis_lib
import redis as redis_base_lib
from pydantic import BaseSettings, RedisDsn, PostgresDsn, BaseModel
from pydantic_settings import BaseSettings
from pydantic import RedisDsn, PostgresDsn, BaseModel
import meilisearch as MeiliSearch
from typing import Optional
from arq import create_pool
@@ -32,23 +33,25 @@ class Settings(BaseSettings):
redis: RedisDsn = "redis://localhost:6379/0?decode_responses=True"
skip_email_verification: bool = False
db_url: str | PostgresDsn = "postgresql://postgres:mysecretpassword@localhost:5432/classquiz"
hcaptcha_key: str | None = None
hcaptcha_key: str = "3852831a-48b4-4236-b0de-9769a1998468"
recaptcha_key: str | None = None
mail_address: str
mail_password: str
mail_username: str
mail_server: str
mail_port: int
secret_key: str
# mail_address: str
mail_address: str = "778@madeupaddress.com"
# mail_password: str
mail_password: str = "mail_passwordstring"
mail_username: str = "mail_userstring"
mail_server: str = "mail_serverstring"
mail_port: int = 0
secret_key: str = "secret_keystring"
access_token_expire_minutes: int = 30
cache_expiry: int = 86400
sentry_dsn: str | None
sentry_dsn: str = ""
meilisearch_url: str = "http://127.0.0.1:7700"
meilisearch_index: str = "classquiz"
google_client_id: Optional[str]
google_client_secret: Optional[str]
github_client_id: Optional[str]
github_client_secret: Optional[str]
google_client_id: str = "google_client_idstring"
google_client_secret: str = "google_client_secretstring"
github_client_id: str = "github_client_idstring"
github_client_secret: str = "github_client_secretstring"
custom_openid_provider: CustomOpenIDProvider | None = None
telemetry_enabled: bool = True
free_storage_limit: int = 1074000000
@@ -57,16 +60,16 @@ class Settings(BaseSettings):
registration_disabled: bool = False
# storage_backend
storage_backend: str | None = "local"
storage_backend: str = "local"
# if storage_backend == "local":
storage_path: str | None
storage_path: str = "/tmp/storage"
# if storage_backend == "s3":
s3_access_key: str | None
s3_secret_key: str | None
s3_access_key: str = "s3_access_keystring"
s3_secret_key: str = "s3_secret_keystring"
s3_bucket_name: str = "classquiz"
s3_base_url: str | None
s3_base_url: str = "s3_base_urlstring"
class Config:
env_file = ".env"
@@ -85,7 +88,7 @@ def settings() -> Settings:
return Settings()
pool = redis_lib.ConnectionPool().from_url(settings().redis)
pool = redis_lib.ConnectionPool().from_url(str(settings().redis))
redis: redis_base_lib.client.Redis = redis_lib.Redis(connection_pool=pool)
arq: ArqRedis = ArqRedis(pool_or_conn=pool)