Initial commit

This commit is contained in:
zhouchengrong
2024-03-11 10:29:58 +08:00
commit bf06c7c120
15 changed files with 283 additions and 0 deletions

20
app/core/config.py Normal file
View File

@@ -0,0 +1,20 @@
import os
from dotenv import load_dotenv
from pydantic import BaseSettings
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
load_dotenv(os.path.join(BASE_DIR, '.env'))
class Settings(BaseSettings):
PROJECT_NAME = os.getenv('PROJECT_NAME', 'FASTAPI BASE')
SECRET_KEY = os.getenv('SECRET_KEY', '')
API_PREFIX = ''
BACKEND_CORS_ORIGINS = ['*']
DATABASE_URL = os.getenv('SQL_DATABASE_URL', '')
ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days
SECURITY_ALGORITHM = 'HS256'
LOGGING_CONFIG_FILE = os.path.join(BASE_DIR, 'logging_env.py')
settings = Settings()