chore(erp): 清理ERP_API_KEY硬编码默认值+任务脚本小调整(与本次待办跳转修复无关,单独成commit)

This commit is contained in:
Hermes CI Fix
2026-08-31 15:33:07 +08:00
parent 74dc9baff5
commit 79bc877f31
11 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ from app.database import get_session_local
from app.models import KPIDefinition, KPIValue from app.models import KPIDefinition, KPIValue
ERP_API = "http://127.0.0.1:8300" ERP_API = "http://127.0.0.1:8300"
ERP_KEY = os.environ.get("ERP_API_KEY", "erp-gateway-key-bhwl-2026") ERP_KEY = os.environ.get("ERP_API_KEY", "")
async def _get(url: str, params: dict = None): async def _get(url: str, params: dict = None):
async with httpx.AsyncClient(timeout=20) as c: async with httpx.AsyncClient(timeout=20) as c:
+1 -1
View File
@@ -11,7 +11,7 @@ from app.models import StandardCost, ActualCost, AbcActivity, AbcAllocation, KPI
logger = logging.getLogger("cma.cost") logger = logging.getLogger("cma.cost")
ERP_API = "http://127.0.0.1:8300" ERP_API = "http://127.0.0.1:8300"
ERP_KEY = os.environ.get("ERP_API_KEY", "erp-gateway-key-bhwl-2026") ERP_KEY = os.environ.get("ERP_API_KEY", "")
# ============================================================ # ============================================================
+1 -1
View File
@@ -28,7 +28,7 @@ try:
else: else:
s = DataSourceConfig(name='ERP系统 - 博海网络', source_type='erp', s = DataSourceConfig(name='ERP系统 - 博海网络', source_type='erp',
api_endpoint='http://127.0.0.1:8300/api/v1', api_endpoint='http://127.0.0.1:8300/api/v1',
api_key='erp-gateway-key-bhwl-2026', sync_type='batch', status='active') api_key=os.getenv("ERP_API_KEY", ""), sync_type='batch', status='active')
db.add(s); db.commit(); db.refresh(s) db.add(s); db.commit(); db.refresh(s)
print(f" [OK] 插入成功: id={s.id}") print(f" [OK] 插入成功: id={s.id}")
for r in db.query(DataSourceConfig).all(): for r in db.query(DataSourceConfig).all():
+1 -1
View File
@@ -31,7 +31,7 @@ try:
name='ERP系统 - 博海网络', name='ERP系统 - 博海网络',
source_type='erp', source_type='erp',
api_endpoint='http://127.0.0.1:8300/api/v1', api_endpoint='http://127.0.0.1:8300/api/v1',
api_key='erp-gateway-key-bhwl-2026', api_key=os.getenv("ERP_API_KEY", ""),
sync_type='batch', sync_type='batch',
status='active', status='active',
) )
+1 -1
View File
@@ -35,7 +35,7 @@ try:
name='ERP系统 - 博海网络', name='ERP系统 - 博海网络',
source_type='erp', source_type='erp',
api_endpoint='http://127.0.0.1:8300/api/v1', api_endpoint='http://127.0.0.1:8300/api/v1',
api_key='erp-gateway-key-bhwl-2026', api_key=os.getenv("ERP_API_KEY", ""),
sync_type='batch', sync_type='batch',
status='active', status='active',
) )
+1 -1
View File
@@ -36,7 +36,7 @@ try:
name='ERP系统 - 博海网络', name='ERP系统 - 博海网络',
source_type='erp', source_type='erp',
api_endpoint='http://127.0.0.1:8300/api/v1', api_endpoint='http://127.0.0.1:8300/api/v1',
api_key='erp-gateway-key-bhwl-2026', api_key=os.getenv("ERP_API_KEY", ""),
sync_type='batch', sync_type='batch',
status='active', status='active',
) )
+1 -1
View File
@@ -25,7 +25,7 @@ try:
name='ERP系统 - 博海网络', name='ERP系统 - 博海网络',
source_type='erp', source_type='erp',
api_endpoint='http://127.0.0.1:8300/api/v1', api_endpoint='http://127.0.0.1:8300/api/v1',
api_key='erp-gateway-key-bhwl-2026', api_key=os.getenv("ERP_API_KEY", ""),
sync_type='batch', sync_type='batch',
status='active', status='active',
) )
+1 -1
View File
@@ -21,7 +21,7 @@ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(me
logger = logging.getLogger("erp_schema_collect") logger = logging.getLogger("erp_schema_collect")
ERP_API_BASE = "http://127.0.0.1:8300/api/v1" ERP_API_BASE = "http://127.0.0.1:8300/api/v1"
ERP_API_KEY = os.getenv("ERP_API_KEY", "erp-gateway-key-bhwl-2026") ERP_API_KEY = os.getenv("ERP_API_KEY", "")
HEADERS = { HEADERS = {
"X-API-Key": ERP_API_KEY, "X-API-Key": ERP_API_KEY,
+1 -1
View File
@@ -14,7 +14,7 @@ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(me
logger = logging.getLogger("erp_schema_v2") logger = logging.getLogger("erp_schema_v2")
API_BASE = "http://127.0.0.1:8300/api/v1" API_BASE = "http://127.0.0.1:8300/api/v1"
API_KEY = os.getenv("ERP_API_KEY", "erp-gateway-key-bhwl-2026") API_KEY = os.getenv("ERP_API_KEY", "")
HEADERS = {"X-API-Key": API_KEY} HEADERS = {"X-API-Key": API_KEY}
+1 -1
View File
@@ -28,7 +28,7 @@ logger = logging.getLogger("erp_sync")
# ERP API 配置 # ERP API 配置
ERP_API_BASE = os.getenv("ERP_API_BASE", "http://127.0.0.1:8300/api/v1") ERP_API_BASE = os.getenv("ERP_API_BASE", "http://127.0.0.1:8300/api/v1")
ERP_API_KEY = os.getenv("ERP_API_KEY", "erp-gateway-key-bhwl-2026") ERP_API_KEY = os.getenv("ERP_API_KEY", "")
# 无DB会话时使用的静态映射(保底,使用真实KPI编码) # 无DB会话时使用的静态映射(保底,使用真实KPI编码)
# 对应 data_source_config 表的 active 端点(id=1,2,3,4 # 对应 data_source_config 表的 active 端点(id=1,2,3,4
+1 -1
View File
@@ -9,7 +9,7 @@ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(me
logger = logging.getLogger("schema_fix") logger = logging.getLogger("schema_fix")
API_BASE = "http://127.0.0.1:8300/api/v1" API_BASE = "http://127.0.0.1:8300/api/v1"
API_KEY = os.getenv("ERP_API_KEY", "erp-gateway-key-bhwl-2026") API_KEY = os.getenv("ERP_API_KEY", "")
HEADERS = {"X-API-Key": API_KEY} HEADERS = {"X-API-Key": API_KEY}
def api_get(path): def api_get(path):