fix(build): getConfig 显式传宿主根目录(否则相对路径解析到模块自身目录找不到 conf)
This commit is contained in:
parent
19a3d67c68
commit
7c21378296
10
build.sh
10
build.sh
@ -25,7 +25,7 @@ echo "Host app root: $APP_ROOT"
|
||||
|
||||
# ── 1. 建表(幂等:CREATE TABLE IF NOT EXISTS 由 json2ddl 产物改造)──
|
||||
cd "$SCRIPT_DIR"
|
||||
"$PYTHON" - <<'PYEOF'
|
||||
"$PYTHON" - "$APP_ROOT" <<'PYEOF'
|
||||
import re, sys, os
|
||||
ddl = open('mysql.ddl.sql', encoding='utf-8').read()
|
||||
# json2ddl 产物含 drop table if exists,部署期改为 IF NOT EXISTS 幂等建表
|
||||
@ -35,12 +35,12 @@ open('/tmp/pipeline_bidding_ddl.sql', 'w', encoding='utf-8').write(ddl)
|
||||
print('DDL prepared:', ddl.count('CREATE TABLE IF NOT EXISTS'), 'tables')
|
||||
PYEOF
|
||||
|
||||
"$PYTHON" - <<'PYEOF'
|
||||
"$PYTHON" - "$APP_ROOT" <<'PYEOF'
|
||||
import sys, os, subprocess
|
||||
sys.path.insert(0, os.getcwd())
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from appPublic.aes import aes_decode_b64
|
||||
cfg = getConfig('.', {'workdir': '.'})
|
||||
cfg = getConfig(sys.argv[1], {'workdir': sys.argv[1]})
|
||||
kw = cfg.databases['pipeline'].kwargs
|
||||
pwd = aes_decode_b64(cfg.password_key, kw.password)
|
||||
with open('/tmp/pipeline_bidding_ddl.sql', 'rb') as f:
|
||||
@ -56,7 +56,7 @@ PYEOF
|
||||
|
||||
# ── 2. 种子数据:appcodes 字典 + pipelines 产线记录(数据源 init/data.json,幂等)──
|
||||
cd "$APP_ROOT"
|
||||
"$PYTHON" - "$SCRIPT_DIR" <<'PYEOF'
|
||||
"$PYTHON" - "$SCRIPT_DIR" "$APP_ROOT" <<'PYEOF'
|
||||
import sys, os, json, asyncio
|
||||
CDIR = sys.argv[1]
|
||||
sys.path.insert(0, os.getcwd())
|
||||
@ -67,7 +67,7 @@ from appPublic.uniqueID import getID
|
||||
data = json.load(open(os.path.join(CDIR, 'init', 'data.json')))
|
||||
|
||||
async def seed():
|
||||
config = getConfig('.')
|
||||
config = getConfig(sys.argv[2], {'workdir': sys.argv[2]})
|
||||
db = DBPools(config.databases)
|
||||
async with db.sqlorContext('pipeline') as sor:
|
||||
# pipelines 产线主记录(checklist 第 0 步)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user