-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsettings.py
More file actions
45 lines (33 loc) · 1.47 KB
/
settings.py
File metadata and controls
45 lines (33 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
import string
from functools import lru_cache
from typing import List
from auth_lib.fastapi import UnionAuthSettings
from pydantic import ConfigDict, DirectoryPath, PostgresDsn, RedisDsn
from pydantic_settings import BaseSettings
class Settings(UnionAuthSettings, BaseSettings):
"""Application settings"""
DB_DSN: PostgresDsn = 'postgresql://postgres@localhost:5432/postgres'
REDIS_DSN: RedisDsn = 'redis://localhost:6379/0'
ROOT_PATH: str = '/' + os.getenv('APP_NAME', '')
CONTENT_TYPES: List[str] = ['application/pdf']
MAX_SIZE: int = 26214400 # Максимальный размер файла в байтах
MAX_PAGE_COUNT: int = 50
STORAGE_TIME: int = 7 * 24 # Время хранения файла в часах
STATIC_FOLDER: DirectoryPath | None = None
ALLOW_STUDENT_NUMBER: bool = False
PIN_SYMBOLS: str = string.ascii_uppercase + string.digits
PIN_LENGTH: int = 6
CORS_ALLOW_ORIGINS: list[str] = ['*']
CORS_ALLOW_CREDENTIALS: bool = True
CORS_ALLOW_METHODS: list[str] = ['*']
CORS_ALLOW_HEADERS: list[str] = ['*']
QR_TOKEN_PREFIX: str = ""
QR_TOKEN_SYMBOLS: str = string.ascii_uppercase + string.digits
QR_TOKEN_LENGTH: int = 6
QR_TOKEN_TTL: int = 30 # Show time of QR code in seconds
QR_TOKEN_DELAY: int = 5 # How long QR code valid after hide in seconds
model_config = ConfigDict(env_file=".env", extra="allow")
@lru_cache()
def get_settings() -> Settings:
return Settings()