백엔드 전체 구현 완료: 내부 서비스(Auth, Client, Realtime), API 엔드포인트 및 스케줄러 구현

This commit is contained in:
2026-02-02 23:55:07 +09:00
parent 03027d2206
commit 4f0cc05f39
22 changed files with 1279 additions and 23 deletions

View File

@@ -0,0 +1,55 @@
import os
from typing import List, Union
from pydantic import AnyHttpUrl, field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
PROJECT_NAME: str = "BatchuKis Backend"
API_V1_STR: str = "/api"
# Server Config
PORT: int = 80
HOST: str = "0.0.0.0"
# Security: CORS & Allowed Hosts
# In production, this should be set to ["kis.tindevil.com"]
ALLOWED_HOSTS: List[str] = ["localhost", "127.0.0.1", "kis.tindevil.com"]
# CORS Origins
BACKEND_CORS_ORIGINS: List[Union[str, AnyHttpUrl]] = [
"http://localhost",
"http://localhost:3000",
"https://kis.tindevil.com",
]
# Database
# Using aiosqlite for async SQLite
DATABASE_URL: str = "sqlite+aiosqlite:///./kis_stock.db"
# Timezone
TIMEZONE: str = "Asia/Seoul"
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=True,
extra="ignore"
)
@field_validator("ALLOWED_HOSTS", mode="before")
def assemble_allowed_hosts(cls, v: Union[str, List[str]]) -> List[str]:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
@field_validator("BACKEND_CORS_ORIGINS", mode="before")
def assemble_cors_origins(cls, v: Union[str, List[str]]) -> List[Union[str, AnyHttpUrl]]:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
settings = Settings()