57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
import os
|
|
import typing
|
|
|
|
from pydantic import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
VERSION: str = "0.1.0"
|
|
APP_TITLE: str = "Template Application"
|
|
PROJECT_NAME: str = "Template Application"
|
|
APP_DESCRIPTION: str = "Description"
|
|
|
|
CORS_ORIGINS: typing.List = ["*"]
|
|
CORS_ALLOW_CREDENTIALS: bool = True
|
|
CORS_ALLOW_METHODS: typing.List = ["*"]
|
|
CORS_ALLOW_HEADERS: typing.List = ["*"]
|
|
|
|
DEBUG = True
|
|
DB_URL: str = "sqlite://db.sqlite3"
|
|
DB_CONNECTIONS: dict = {
|
|
"default": {
|
|
"engine": "tortoise.backends.sqlite",
|
|
"db_url": DB_URL,
|
|
"credentials": {
|
|
"host": "",
|
|
"port": "",
|
|
"user": "",
|
|
"password": "",
|
|
"database": "",
|
|
},
|
|
},
|
|
}
|
|
|
|
PROJECT_ROOT: str = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
|
BASE_DIR: str = os.path.abspath(os.path.join(PROJECT_ROOT, os.pardir))
|
|
LOGS_ROOT: str = os.path.join(BASE_DIR, "app/logs")
|
|
SECRET_KEY: str = "3488a63e1765035d386f05409663f55c83bfae3b3c61a932744b20ad14244dcf" # openssl rand -hex 32
|
|
JWT_ALGORITHM: str = "HS256"
|
|
JWT_ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 # 7 day
|
|
TORTOISE_ORM = {
|
|
"connections": {
|
|
"sqlite": {
|
|
"engine": "tortoise.backends.sqlite",
|
|
"credentials": {"file_path": f"{BASE_DIR}/db.sqlite3"},
|
|
}
|
|
},
|
|
"apps": {
|
|
"models": {
|
|
"models": ["app.models"],
|
|
"default_connection": "sqlite",
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
settings = Settings()
|