# -*- coding: utf-8 -*- """ 도매상 설정 중앙 관리 사용법: from config import get_wholesalers, get_wholesaler # 전체 도매상 목록 wholesalers = get_wholesalers() # 특정 도매상 정보 geo = get_wholesaler('geoyoung') print(geo['name']) # 지오영 print(geo['logo']) # /static/img/logo_geoyoung.ico """ import json from pathlib import Path _config = None _config_path = Path(__file__).parent / 'wholesalers.json' def _load_config(): global _config if _config is None: with open(_config_path, 'r', encoding='utf-8') as f: _config = json.load(f) return _config def get_wholesalers(): """전체 도매상 목록 반환 (순서대로)""" config = _load_config() order = config.get('order', []) wholesalers = config.get('wholesalers', {}) return [wholesalers[key] for key in order if key in wholesalers] def get_wholesaler(wholesaler_id: str): """특정 도매상 정보 반환""" config = _load_config() return config.get('wholesalers', {}).get(wholesaler_id) def get_all_wholesalers_dict(): """전체 도매상 딕셔너리 반환""" config = _load_config() return config.get('wholesalers', {}) def get_config(): """전체 설정 반환""" return _load_config()