老板要求「全改」,所以这次不只是展示名:
仓库
· Gitea Jidekin/api-gateway → Jidekin/xiaoyin-gateway
· GitHub wangjinding/api-gateway → wangjinding/xiaoyin-gateway
· 本地 remote 两个都改了,ls-remote 验证可访问
本机
· /root/dsh/projects/api-gateway → xiaoyin-gateway
· /root/.venvs/api-gateway → xiaoyin-gateway
· supervisor [program:api-gateway] → [program:xiaoyin-gateway]
(reread + update + 重启后 RUNNING,根接口正常返回 小银网关 2.9.16)
引用同步
· security/uptime-check.sh、backup-app-data.sh、backup-restore-drill.sh 的路径
· AGENTS.md、home-network.md(后者已同步思源)
· README / CHANGELOG / docs / Makefile 提示语 / 前端包名 / 站点里的 git clone 地址
有意保留的两处
· 前端备份数据的 kind: 'api-gateway-backup' —— 数据格式标识,改了旧备份认不出来
· frontend/dist 里的同名常量(同上)
41 lines
1.8 KiB
Makefile
41 lines
1.8 KiB
Makefile
# 小银网关 快捷命令
|
||
# Windows 若无 make,可手动执行对应命令;或装 https://chocolatey.org/packages/make
|
||
|
||
.DEFAULT_GOAL := help
|
||
CONFIG := data/gateway.yaml
|
||
PORT ?= 8808
|
||
|
||
.PHONY: help install run test lint clean
|
||
|
||
help: ## 显示帮助
|
||
@echo "小银网关 常用命令:"
|
||
@echo " make install 安装依赖"
|
||
@echo " make run 本地启动(端口 $(PORT))"
|
||
@echo " make test 跑单元测试(不依赖真实上游)"
|
||
@echo " make lint 语法编译检查"
|
||
@echo " make clean 清理缓存/临时文件"
|
||
|
||
install: ## 安装依赖
|
||
pip install -r requirements.txt
|
||
pip install pytest httpx # 测试依赖(测试用,非运行必需)
|
||
|
||
run: ## 本地启动
|
||
@python -c "import os,sys,subprocess; env=dict(os.environ); env['GATEWAY_CONFIG']='$(CONFIG)'; env['GATEWAY_PORT']='$(PORT)'; subprocess.call([sys.executable,'run.py'],env=env)"
|
||
|
||
test: ## 跑单元测试
|
||
python tests/test_gateway.py
|
||
# 第三十轮: 原来这里写「或: pytest tests/ -q」—— 但环境里**没装 pytest**,
|
||
# 照着敲只会报 command not found。这套单测其实是**自带 runner 的独立脚本**
|
||
# (`python tests/test_gateway.py` 直接跑,pytest 只是可选外壳):
|
||
# 装了 pytest 时 `pytest tests/ -q` 收集的是同一批 test_* 函数,结果等价。
|
||
|
||
lint: ## 语法编译检查
|
||
# 第三十轮: 原来是一个**手写文件清单** —— 新增 app/users.py / history.py / feedback.py /
|
||
# settings.py / sessions.py / video_owners.py 时没人回来补,等于这几个文件从没被 lint 过。
|
||
# 改成 compileall:整个包都覆盖,以后加文件也不用记得改这里。
|
||
python -m compileall -q app run.py
|
||
@echo "syntax OK"
|
||
|
||
clean: ## 清理
|
||
@python -c "import shutil,glob,os; [shutil.rmtree(os.path.join(d,'__pycache__'),ignore_errors=True) for d in glob.glob('**',recursive=True)]"
|