Files
sora_python/app/core/config.py
2024-10-22 15:20:03 +08:00

57 lines
1.7 KiB
Python

import logging
import os
from typing import ClassVar
from dotenv import load_dotenv
from pydantic_settings import BaseSettings
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
logging.info(f"BASE_DIR : {BASE_DIR}")
load_dotenv(os.path.join(BASE_DIR, '.env'))
class Settings(BaseSettings):
PROJECT_NAME: ClassVar[str] = 'FASTAPI BASE'
SECRET_KEY: str = ''
API_PREFIX: str = ''
BACKEND_CORS_ORIGINS: list[str] = ['*']
DATABASE_URL: str = ''
ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days
SECURITY_ALGORITHM: str = 'HS256'
LOGGING_CONFIG_FILE: str = os.path.join(BASE_DIR, 'logging_env.py')
settings = Settings()
MINIO_IP = "18.167.251.121"
MINIO_PORT = 8000
MINIO_SECURE = False
MINIO_ACCESS = "e8zc55mzDOh4IzRrZ9Oa"
MINIO_SECRET = "uHfqJ7UkwA1PTDGfnA44Hp9ux5YkZTkzZLjeOYhE"
OM_TRITON_IP = "10.1.1.240"
OM_TRITON_PORT = "20000"
ATT_TRITON_IP = "10.1.1.240"
ATT_TRITON_PORT = "20010"
MILVUS_URL = "http://10.1.1.240:19530"
DEBUG = 1
SHOW_OR_SAVE_result_image = False
# service env : 1
# pycharm debug : 2
SIMILAR_MATCH_DRAW = False
if DEBUG == 1:
LOGS_PATH = "app/logs/errors.log"
FASHION_CATEGORIES = "app/service/outfit_matcher/config/fashion_categories.json"
FASHION_CATEGORIES_MAPPING = "app/service/outfit_matcher/config/fashion_category_mapping.json"
elif DEBUG == 2:
LOGS_PATH = "logs/errors.log"
FASHION_CATEGORIES = "service/outfit_matcher/config/fashion_categories.json"
FASHION_CATEGORIES_MAPPING = "service/outfit_matcher/config/fashion_category_mapping.json"
elif DEBUG == 3:
LOGS_PATH = "app/logs/errors.log"
FASHION_CATEGORIES = "./config/fashion_categories.json"
FASHION_CATEGORIES_MAPPING = "./config/fashion_category_mapping.json"