sandersyao/dsh-storage-mysql ↗★ 0
@sandersyao/dsh-storage-mysql
基于 MySQL 的 DeepSeek Harness 存储中心(ctx.storage)后端插件。
AI 分析
核心用途是将 DSH 的领域存储数据路由至 MySQL 数据库。适合需要将应用数据、配置等统一存储在关系型数据库中以方便备份和扩展的开发者。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:sandersyao/dsh-storage-mysql说明文档
阅读完整 README ↗Install & usage
import { apply, Config, inject, name } from '@sandersyao/dsh-storage-mysql'
// Route the storage-domain facility to this backend:
// ctx.plugin({ apply, Config, inject, name }, { connection: { tablePrefix: 'dsh_storage_' } })
// With storage-domain config { backend: 'mysql' }, ctx.storage.domain is MySQL-backed.
Easiest path is the bundle patch (see below): add the package and its
cordis.patch.yml keeps the default storage-json backend and simply points
storage-domain.backend at mysql — the json backend stays available for
per-domain routes.
Configuration
Connection details come from environment variables / a .env file (see
.env.example). Independent STORAGE_* win; they fall back to the shared
MYSQL_* — reuse the same connection when co-existing with
dsh-session-persistence-mysql / dsh-credentials-mysql, or configure
independently. The plugin Config is optional (only non-secret overrides);
credentials never live in code or config.
| Env | Fallback | Default | Purpose |
|---|---|---|---|
STORAGE_HOST | MYSQL_HOST | 127.0.0.1 | Host. |
STORAGE_PORT | MYSQL_PORT | 3306 | Port. |
STORAGE_USER | MYSQL_USER | — (required) | Least-privilege DB user. |
STORAGE_PASSWORD | MYSQL_PASSWORD | — (required) | Password. |
STORAGE_DATABASE | MYSQL_DATABASE | — (required) | Target database. |
STORAGE_TABLE_PREFIX | MYSQL_TABLE_PREFIX | — (required) | Table prefix, validated ^[A-Za-z0-9_]+$; base names distinct from session/credentials. |
STORAGE_SSL_REQUIRED | MYSQL_SSL_REQUIRED | false | TLS (deferred). |
STORAGE_POOL_SIZE | MYSQL_POOL_SIZE | 10 | Pool sizing. |
STORAGE_SCHEMA_AUTO_MIGRATE | MYSQL_SCHEMA_AUTO_MIGRATE | true | Auto-migrate schema on startup. |
Test isolation. Automated tests run against a separate database (
STORAGE_TEST_DATABASE, defaulttest);MYSQL_ROOT_PASSWORDis used only by the test harness to create/grant it.