2024-03-28 10:30:18 +08:00
|
|
|
import logging
|
|
|
|
|
import os
|
2024-10-22 15:11:08 +08:00
|
|
|
from typing import ClassVar
|
|
|
|
|
|
2024-03-28 10:30:18 +08:00
|
|
|
from dotenv import load_dotenv
|
2024-10-22 15:11:08 +08:00
|
|
|
from pydantic_settings import BaseSettings
|
2024-03-28 10:30:18 +08:00
|
|
|
|
|
|
|
|
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):
|
2024-10-22 15:11:08 +08:00
|
|
|
PROJECT_NAME: ClassVar[str] = 'FASTAPI BASE'
|
|
|
|
|
SECRET_KEY: str = ''
|
|
|
|
|
API_PREFIX: str = ''
|
|
|
|
|
BACKEND_CORS_ORIGINS: list[str] = ['*']
|
|
|
|
|
DATABASE_URL: str = ''
|
2024-03-28 10:30:18 +08:00
|
|
|
ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days
|
2024-10-22 15:11:08 +08:00
|
|
|
SECURITY_ALGORITHM: str = 'HS256'
|
|
|
|
|
LOGGING_CONFIG_FILE: str = os.path.join(BASE_DIR, 'logging_env.py')
|
2024-03-28 10:30:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
2024-05-20 11:09:27 +08:00
|
|
|
OM_TRITON_PORT = "20000"
|
2024-03-28 10:30:18 +08:00
|
|
|
|
|
|
|
|
ATT_TRITON_IP = "10.1.1.240"
|
2024-05-20 11:09:27 +08:00
|
|
|
ATT_TRITON_PORT = "20010"
|
2024-03-28 10:30:18 +08:00
|
|
|
|
2024-04-03 15:14:33 +08:00
|
|
|
MILVUS_URL = "http://10.1.1.240:19530"
|
|
|
|
|
|
2024-10-22 15:34:33 +08:00
|
|
|
DEBUG = 1
|
2024-04-05 17:45:25 +08:00
|
|
|
SHOW_OR_SAVE_result_image = False
|
2024-03-28 17:22:51 +08:00
|
|
|
# service env : 1
|
|
|
|
|
# pycharm debug : 2
|
2024-04-10 14:33:06 +08:00
|
|
|
SIMILAR_MATCH_DRAW = False
|
2024-03-28 17:22:51 +08:00
|
|
|
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"
|