mirror of
https://github.com/beilunyang/moemail.git
synced 2026-04-25 03:25:47 +03:00
[PR #89] Update index.ts #92
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/moemail#92
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/beilunyang/moemail/pull/89
State: closed
Merged: Yes
🐛 Bug Fix: 修复部署脚本中环境变量推送失败的问题
📋 问题描述
在 CI/CD 部署过程中,
pushPagesSecret函数在推送环境变量到 Cloudflare Pages 时失败,报错:错误日志:
🔍 根本原因
wrangler pages secret bulk命令要求输入文件必须是有效的 JSON 格式,但原代码生成的.env.runtime文件是标准的.env格式(键值对格式):而 Wrangler 期望的格式是:
✨ 解决方案
修改
scripts/deploy/index.ts中的pushPagesSecret函数:.env格式的环境变量解析为 JavaScript 对象,然后使用JSON.stringify()转换为 JSON 格式.env.runtime改为.env.runtime.json,更清晰地表明文件格式indexOf('=')替代split('='),正确处理值中包含=的情况🧪 测试验证
📊 影响范围
scripts/deploy/index.ts[PR #89] [MERGED] Update index.tsto [PR #89] Update index.ts