- Add TursoAdapter implementing DatabaseAdapter interface using @libsql/client - Add 'turso' storage type to db.ts storage selector (reuses D1Storage) - Add init-turso.js script for database migration and admin initialization - Add @libsql/client dependency to package.json - Update next.config.js to exclude @libsql/client from client-side bundle - Update edgeone-deploy.yml workflow with TURSO_URL and TURSO_TOKEN secrets - Update edgeone-build.mjs runtime env keys to include Turso variables - Update .env.edgeone.example with Turso deployment instructions - Update README.md with Turso as recommended storage for EdgeOne Turso provides free SQLite-compatible cloud database (libSQL) with: - 500 databases, 9GB storage, 1B row reads/month on free tier - HTTP API compatible with edge/serverless environments - Full SQLite syntax compatibility, reuses existing migrations
30 lines
1.0 KiB
Bash
30 lines
1.0 KiB
Bash
# EdgeOne Pages 本地调试示例环境变量
|
||
# 使用方式:cp .env.edgeone.example .env.local 后按需修改,再运行 pnpm preview:edgeone
|
||
|
||
NODE_ENV=production
|
||
BUILD_TARGET=edgeone
|
||
EDGEONE_PAGES=1
|
||
|
||
# 默认不设置 NEXT_PUBLIC_STORAGE_TYPE,项目会使用默认 localstorage。
|
||
# 如需云端持久化,可选用以下存储方案:
|
||
#
|
||
# 方案一:Turso(推荐,免费 SQLite 云数据库)
|
||
# 1. 注册 https://turso.tech 获取免费数据库
|
||
# 2. 设置 NEXT_PUBLIC_STORAGE_TYPE=turso
|
||
# 3. 运行 pnpm init:turso 初始化数据库表结构
|
||
# 4. 配置 TURSO_URL 和 TURSO_TOKEN
|
||
#
|
||
# 方案二:Upstash Redis(KV 存储)
|
||
# 1. 注册 https://upstash.com 获取免费 Redis
|
||
# 2. 设置 NEXT_PUBLIC_STORAGE_TYPE=upstash
|
||
# 3. 配置 UPSTASH_URL 和 UPSTASH_TOKEN
|
||
|
||
# 管理员账号(请替换)
|
||
USERNAME=admin
|
||
PASSWORD=admin123
|
||
|
||
# 如果你要在 EdgeOne 控制台使用云端环境变量,也可以先登录/关联项目后执行:
|
||
# pnpm edgeone:login
|
||
# pnpm edgeone:link
|
||
# pnpm exec edgeone makers env pull -f .env.local
|