secrets
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoldsky Secrets Management
Goldsky 密钥管理
Create and manage secrets for pipeline sink credentials.
创建和管理管道sink凭证的密钥。
Agent Instructions
Agent 操作说明
When this skill is invoked, follow this streamlined workflow:
当调用此技能时,请遵循以下简化工作流:
Step 1: Verify Login + List Existing Secrets
步骤1:验证登录 + 列出现有密钥
Run to confirm authentication and show existing secrets.
goldsky secret listIf authentication fails: Invoke the skill first.
auth-setup运行以确认身份验证并显示现有密钥。
goldsky secret list如果身份验证失败: 先调用技能。
auth-setupStep 2: Determine Intent Quickly
步骤2:快速确定用户意图
Skip unnecessary questions. If the user's intent is clear from context, proceed directly:
- User says "create a postgres secret" → Go straight to credential collection
- User pastes a connection string → Parse it immediately (see Connection String Parsing)
- User mentions a specific provider (Neon, Supabase, etc.) → Use provider-specific guidance
Only use AskUserQuestion if intent is genuinely unclear.
跳过不必要的问题。 如果从上下文可明确用户意图,直接执行:
- 用户说“create a postgres secret” → 直接进入凭证收集环节
- 用户粘贴连接字符串 → 立即解析(参见连接字符串解析部分)
- 用户提及特定提供商(Neon、Supabase等) → 使用提供商专属指引
仅当意图确实不明确时,才使用AskUserQuestion。
Step 3: Connection String Parsing (Preferred for PostgreSQL)
步骤3:连接字符串解析(PostgreSQL首选方式)
If user provides a connection string, parse it directly instead of asking questions.
PostgreSQL connection string format:
postgres://USER:PASSWORD@HOST:PORT/DATABASE?sslmode=require
postgresql://USER:PASSWORD@HOST/DATABASEParsing logic:
- Extract: ,
user,password,host(default 5432),portdatabaseName - Construct JSON immediately
- Create the secret without further questions
Example - user provides:
postgresql://neondb_owner:abc123@ep-cool-name.us-east-2.aws.neon.tech/neondb?sslmode=requireCreate using the connection string directly:
bash
goldsky secret create --name SUGGESTED_NAME如果用户提供连接字符串,直接解析而非询问问题。
PostgreSQL连接字符串格式:
postgres://USER:PASSWORD@HOST:PORT/DATABASE?sslmode=require
postgresql://USER:PASSWORD@HOST/DATABASE解析逻辑:
- 提取:、
user、password、host(默认5432)、portdatabaseName - 立即构造JSON
- 无需进一步询问即可创建密钥
示例 - 用户提供:
postgresql://neondb_owner:abc123@ep-cool-name.us-east-2.aws.neon.tech/neondb?sslmode=require直接使用连接字符串创建:
bash
goldsky secret create --name SUGGESTED_NAMEWhen prompted, paste the connection string:
当出现提示时,粘贴连接字符串:
postgresql://neondb_owner:abc123@ep-cool-name.us-east-2.aws.neon.tech/neondb?sslmode=require
postgresql://neondb_owner:abc123@ep-cool-name.us-east-2.aws.neon.tech/neondb?sslmode=require
undefinedundefinedStep 4: Provider-Specific Quick Paths
步骤4:提供商专属快捷流程
Neon:
- Connection string format:
postgresql://USER:PASS@ep-XXX.REGION.aws.neon.tech/neondb - Default port: 5432
- Common issue: Free tier has 512MB limit - pipelines will fail with "project size limit exceeded"
Supabase:
- Connection string format:
postgresql://postgres:PASS@db.PROJECT.supabase.co:5432/postgres - Use the "Connection string" from Project Settings → Database
PlanetScale (MySQL):
- Use and port 3306
"protocol": "mysql"
Neon:
- 连接字符串格式:
postgresql://USER:PASS@ep-XXX.REGION.aws.neon.tech/neondb - 默认端口:5432
- 常见问题:免费版有512MB限制 - 管道会因“项目大小超出限制”失败
Supabase:
- 连接字符串格式:
postgresql://postgres:PASS@db.PROJECT.supabase.co:5432/postgres - 从项目设置→数据库中获取“Connection string”
PlanetScale (MySQL):
- 使用和端口3306
"protocol": "mysql"
Step 5: Create Secret Directly
步骤5:直接创建密钥
Once you have credentials (from parsing or user input), create immediately:
bash
goldsky secret create \
--name SECRET_NAME \
--value '{"type":"jdbc","protocol":"postgres",...}' \
--description "Optional description"Naming convention: (e.g., , )
PROJECT_PROVIDERTRADEWATCH_NEONANALYTICS_SUPABASE一旦获取到凭证(来自解析或用户输入),立即创建:
bash
goldsky secret create \
--name SECRET_NAME \
--value '{"type":"jdbc","protocol":"postgres",...}' \
--description "可选描述"命名规范: (例如:、)
PROJECT_PROVIDERTRADEWATCH_NEONANALYTICS_SUPABASEStep 6: Verify
步骤6:验证
Run to confirm creation.
goldsky secret list运行确认创建成功。
goldsky secret listSecret JSON Schemas
密钥JSON Schema
JSON schema files are available in thefolder. Each file contains the full schema with examples.schemas/
| Secret Type | Schema File | Type Field | Use Case |
|---|---|---|---|
| PostgreSQL | | | Database sink |
| MySQL | | | Database sink (protocol: mysql) |
| ClickHouse | | | Analytics database |
| Kafka | | | Event streaming |
| AWS S3 | | | Object storage |
| ElasticSearch | | | Search engine |
| DynamoDB | | | NoSQL database |
| SQS | | | Message queue |
| OpenSearch | | | Search/analytics |
| Webhook | | | HTTP endpoints |
Schema location: (relative to this skill's directory)
schemas/JSON Schema文件位于文件夹中。 每个文件都包含完整的Schema及示例。schemas/
| 密钥类型 | Schema文件 | Type字段 | 使用场景 |
|---|---|---|---|
| PostgreSQL | | | 数据库sink |
| MySQL | | | 数据库sink(protocol: mysql) |
| ClickHouse | | | 分析型数据库 |
| Kafka | | | 事件流处理 |
| AWS S3 | | | 对象存储 |
| ElasticSearch | | | 搜索引擎 |
| DynamoDB | | | NoSQL数据库 |
| SQS | | | 消息队列 |
| OpenSearch | | | 搜索/分析 |
| Webhook | | | HTTP端点 |
Schema位置: (相对于此技能的目录)
schemas/Quick Reference Examples
快速参考示例
PostgreSQL — Connection string format:
postgres://username:password@host:port/databasebash
goldsky secret create --name MY_POSTGRES_SECRETPostgreSQL — 连接字符串格式:
postgres://username:password@host:port/databasebash
goldsky secret create --name MY_POSTGRES_SECRETThe CLI will prompt for the connection string interactively
CLI会交互式提示输入连接字符串
**ClickHouse** — Connection string format:
**Kafka** — JSON format:
```json
{
"type": "kafka",
"bootstrapServers": "broker:9092",
"securityProtocol": "SASL_SSL",
"saslMechanism": "PLAIN",
"saslJaasUsername": "user",
"saslJaasPassword": "pass"
}S3 — Colon-separated format:
access_key_id:secret_access_keyOr with session token:
access_key_id:secret_access_key:session_tokenWebhook:
Note: Turbo pipeline webhook sinks do not support Goldsky's native secrets management. Include auth headers directly in the pipeline YAMLfield instead.headers:
**ClickHouse** — 连接字符串格式:
**Kafka** — JSON格式:
```json
{
"type": "kafka",
"bootstrapServers": "broker:9092",
"securityProtocol": "SASL_SSL",
"saslMechanism": "PLAIN",
"saslJaasUsername": "user",
"saslJaasPassword": "pass"
}S3 — 冒号分隔格式:
access_key_id:secret_access_key或包含会话令牌:
access_key_id:secret_access_key:session_tokenWebhook:
注意: Turbo管道webhook sink不支持Goldsky的原生密钥管理。请直接在管道YAML的字段中包含身份验证头。headers:
Connection String Parser
连接字符串解析器
For PostgreSQL, use the helper script to parse connection strings:
bash
./scripts/parse-connection-string.sh "postgresql://user:pass@host:5432/dbname"对于PostgreSQL,使用辅助脚本解析连接字符串:
bash
./scripts/parse-connection-string.sh "postgresql://user:pass@host:5432/dbname"Output: JSON ready for goldsky secret create --value
输出:可直接用于goldsky secret create --value的JSON
undefinedundefinedStep 5: Confirm and Create
步骤5:确认并创建
Show the user what will be created (mask password with ***) and ask for confirmation before running the command.
向用户展示即将创建的内容(密码用***掩码),并在执行命令前请求确认。
Step 6: Verify Success
步骤6:验证创建成功
Run to confirm the secret was created.
goldsky secret list运行确认密钥已创建。
goldsky secret listQuick Reference
快速参考
| Action | Command |
|---|---|
| Create | |
| List | |
| Reveal | |
| Update | |
| Delete | |
| 操作 | 命令 |
|---|---|
| 创建 | |
| 列出 | |
| 查看 | |
| 更新 | |
| 删除 | |
Prerequisites
前提条件
- Goldsky CLI installed
- Logged in ()
goldsky login - Connection credentials for your target sink
- 已安装Goldsky CLI
- 已登录()
goldsky login - 目标sink的连接凭证
Why Secrets Are Needed
为何需要密钥
Pipelines that write to external sinks (PostgreSQL, ClickHouse, Kafka, S3) need credentials to connect. Instead of putting credentials directly in your pipeline YAML, you store them as secrets and reference them by name.
Benefits:
- Credentials are encrypted and stored securely
- Pipeline configs can be shared without exposing secrets
- Credentials can be rotated without modifying pipelines
写入外部sink(PostgreSQL、ClickHouse、Kafka、S3)的管道需要凭证才能连接。无需将凭证直接放在管道YAML中,而是将其存储为密钥并通过名称引用。
优势:
- 凭证被加密并安全存储
- 管道配置可共享且不会暴露密钥
- 无需修改管道即可轮换凭证
Command Reference
命令参考
| Command | Purpose | Key Flags |
|---|---|---|
| Create a new secret | |
| List all secrets | |
| Show secret value | |
| Update secret value | |
| Delete a secret | |
| 命令 | 用途 | 关键参数 |
|---|---|---|
| 创建新密钥 | |
| 列出所有密钥 | |
| 查看密钥值 | |
| 更新密钥值 | |
| 删除密钥 | |
Common Patterns
常见模式
PostgreSQL Secret
PostgreSQL密钥
bash
goldsky secret create --name PROD_POSTGRESbash
goldsky secret create --name PROD_POSTGRESWhen prompted, provide the connection string:
出现提示时,提供连接字符串:
postgres://admin:secret@db.example.com:5432/mydb
postgres://admin:secret@db.example.com:5432/mydb
Pipeline usage:
```yaml
sinks:
output:
type: postgres
from: my_source
schema: public
table: transfers
secret_name: PROD_POSTGRES
管道使用方式:
```yaml
sinks:
output:
type: postgres
from: my_source
schema: public
table: transfers
secret_name: PROD_POSTGRESClickHouse Secret
ClickHouse密钥
bash
goldsky secret create --name CLICKHOUSE_ANALYTICSbash
goldsky secret create --name CLICKHOUSE_ANALYTICSWhen prompted, provide the connection string:
出现提示时,提供连接字符串:
Pipeline usage:
```yaml
sinks:
output:
type: clickhouse
from: my_source
table: events
secret_name: CLICKHOUSE_ANALYTICS
primary_key: id
管道使用方式:
```yaml
sinks:
output:
type: clickhouse
from: my_source
table: events
secret_name: CLICKHOUSE_ANALYTICS
primary_key: idRotating Credentials
轮换凭证
Update an existing secret without changing pipeline configs:
bash
goldsky secret update MY_POSTGRES_SECRET --value 'postgres://admin:NEW_PASSWORD@db.example.com:5432/mydb'Active pipelines will pick up the new credentials on their next connection.
无需修改管道配置即可更新现有密钥:
bash
goldsky secret update MY_POSTGRES_SECRET --value 'postgres://admin:NEW_PASSWORD@db.example.com:5432/mydb'运行中的管道会在下次连接时使用新凭证。
Deleting Unused Secrets
删除未使用的密钥
bash
undefinedbash
undefinedWith confirmation prompt
带确认提示
goldsky secret delete OLD_SECRET
goldsky secret delete OLD_SECRET
Skip confirmation (for scripts)
跳过确认(适用于脚本)
goldsky secret delete OLD_SECRET -f
**Warning:** Deleting a secret that's in use will cause pipeline failures.goldsky secret delete OLD_SECRET -f
**警告:** 删除正在使用的密钥会导致管道失败。Secret Naming Conventions
密钥命名规范
Use descriptive, uppercase names with underscores:
| Good | Bad |
|---|---|
| |
| |
| |
Include environment and purpose in the name for clarity.
使用描述性的大写名称,以下划线分隔:
| 规范名称 | 不规范名称 |
|---|---|
| |
| |
| |
名称中包含环境和用途以提升清晰度。
Troubleshooting
故障排除
Error: Secret not found
错误:密钥未找到
Error: Secret 'MY_SECRET' not foundCause: The secret name doesn't exist or is misspelled.
Fix: Run to see available secrets and check the exact name.
Fix: Run
goldsky secret listError: Secret 'MY_SECRET' not found原因: 密钥名称不存在或拼写错误。
解决: 运行查看可用密钥并检查准确名称。
解决: 运行
goldsky secret listError: Secret already exists
错误:密钥已存在
Error: Secret 'MY_SECRET' already existsCause: Attempting to create a secret with a name that's already in use.
Fix: Use to update, or choose a different name.
Fix: Use
goldsky secret update MY_SECRET --value "new-value"Error: Secret 'MY_SECRET' already exists原因: 尝试创建的密钥名称已被使用。
解决: 使用更新,或选择其他名称。
解决: 使用
goldsky secret update MY_SECRET --value "new-value"Error: Invalid secret value format
错误:密钥值格式无效
Error: Invalid JSON in secret valueCause: JSON syntax error in the secret value.
Fix: Validate your JSON before creating the secret:
Fix: Validate your JSON before creating the secret:
bash
undefinedError: Invalid JSON in secret value原因: 密钥值中的JSON语法错误。
解决: 创建密钥前验证JSON有效性:
解决: 创建密钥前验证JSON有效性:
bash
undefinedTest JSON validity
测试JSON有效性
echo '{"url":"...","user":"..."}' | jq .
undefinedecho '{"url":"...","user":"..."}' | jq .
undefinedPipeline fails with "connection refused"
管道因“连接被拒绝”失败
Cause: The credentials in the secret are incorrect or the database is unreachable.
Fix:
Fix:
- Verify credentials work outside Goldsky:
psql "postgresql://..." - Check the secret value:
goldsky secret reveal MY_SECRET - Ensure the database allows connections from Goldsky's IP ranges
原因: 密钥中的凭证不正确或数据库无法访问。
解决:
解决:
- 在Goldsky外验证凭证是否可用:
psql "postgresql://..." - 检查密钥值:
goldsky secret reveal MY_SECRET - 确保数据库允许Goldsky的IP范围连接
Pipeline fails with "authentication failed"
管道因“身份验证失败”失败
Cause: Username or password in the secret is incorrect.
Fix: Update the secret with correct credentials:
bash
goldsky secret update MY_SECRET --value 'postgres://correct:credentials@host:5432/db'原因: 密钥中的用户名或密码不正确。
解决: 使用正确的凭证更新密钥:
bash
goldsky secret update MY_SECRET --value 'postgres://correct:credentials@host:5432/db'Secret value contains special characters
密钥值包含特殊字符
Cause: JSON strings with special characters need proper escaping.
Fix: Use proper JSON escaping for special characters in password fields:
- Backslash: use
\\ - Double quote: use
\" - Newline: use
\n
With the structured JSON format, most special characters in passwords work without URL encoding since the password is a separate field.
原因: 包含特殊字符的JSON字符串需要正确转义。
解决: 对密码字段中的特殊字符使用正确的JSON转义:
- 反斜杠:使用
\\ - 双引号:使用
\" - 换行符:使用
\n
使用结构化JSON格式时,密码中的大多数特殊字符无需URL编码即可正常工作,因为密码是单独的字段。
Related
相关技能
- — Build and deploy pipelines that use these secrets
/turbo-builder - — Invoke this if user is not logged in
/auth-setup - — Pipeline YAML configuration reference
/turbo-pipelines
- — 构建和部署使用这些密钥的管道
/turbo-builder - — 如果用户未登录,调用此技能
/auth-setup - — 管道YAML配置参考
/turbo-pipelines