export-env
Export secrets from SecureCode vault as .env or CSV files with decrypted values for secure configuration management and backup.
Instructions
Export all secrets as .env or CSV format. Returns the full content with decrypted values.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Export format: "env" (default) or "csv" | |
| tags | No | Filter by tags, e.g. { "env": "production" } |
Implementation Reference
- src/index.ts:571-591 (handler)The "export-env" tool implementation which uses getClient().exportEnv() to retrieve secret values and returns them in the requested format.
// Tool: export-env server.tool( 'export-env', 'Export all secrets as .env or CSV format. Returns the full content with decrypted values.', { format: z.enum(['env', 'csv']).optional().describe('Export format: "env" (default) or "csv"'), tags: z.record(z.string(), z.string()).optional().describe('Filter by tags, e.g. { "env": "production" }'), }, async ({ format, tags }) => { try { const content = await getClient().exportEnv({ format: format || 'env', tags }); if (!content || !content.trim()) { return wrapResponse([{ type: 'text', text: 'No secrets to export.' }]); } const lineCount = content.split('\n').filter(l => l.trim() && !l.startsWith('#')).length; return wrapResponse([{ type: 'text', text: `Exported ${lineCount} secrets (${format || 'env'} format):\n\n${content}` }]); } catch (error) { return errorResult(error); } } );