perplexity-multi-env-setup
Configure Perplexity across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Perplexity configurations. Trigger with phrases like "perplexity environments", "perplexity staging", "perplexity dev prod", "perplexity environment setup", "perplexity config by env".
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 2.0k
- Forks
- 231
01 前言 Front Matter
- name
- perplexity-multi-env-setup
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Configure Perplexity across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific Perplexity configurations. Trigger with phrases like "perplexity environments", "perplexity staging", "perplexity dev prod", "perplexity environment setup", "perplexity config by env".
- allowed-tools
- Read, Write, Edit, Bash(aws:*), Bash(gcloud:*), Bash(vault:*)
03 SKILL.md 正文
Perplexity Multi-Environment Setup
Overview
Configure Perplexity across development, staging, and production environments.
Prerequisites
- Separate Perplexity accounts or API keys per environment
- Secret management solution (Vault, AWS Secrets Manager, etc.)
- CI/CD pipeline with environment variables
- Environment detection in application
Environment Strategy
| Environment | Purpose | API Keys | Data |
|---|---|---|---|
| Development | Local dev | Test keys | Sandbox |
| Staging | Pre-prod validation | Staging keys | Test data |
| Production | Live traffic | Production keys | Real data |
Configuration Structure
config/
├── perplexity/
│ ├── base.json # Shared config
│ ├── development.json # Dev overrides
│ ├── staging.json # Staging overrides
│ └── production.json # Prod overrides
base.json
{
"timeout": 30000,
"retries": 3,
"cache": {
"enabled": true,
"ttlSeconds": 60
}
}
development.json
{
"apiKey": "${PERPLEXITY_API_KEY}",
"baseUrl": "https://api-sandbox.perplexity.com",
"debug": true,
"cache": {
"enabled": false
}
}
staging.json
{
"apiKey": "${PERPLEXITY_API_KEY_STAGING}",
"baseUrl": "https://api-staging.perplexity.com",
"debug": false
}
production.json
{
"apiKey": "${PERPLEXITY_API_KEY_PROD}",
"baseUrl": "https://api.perplexity.com",
"debug": false,
"retries": 5
}
Environment Detection
// src/perplexity/config.ts
import baseConfig from '../../config/perplexity/base.json';
type Environment = 'development' | 'staging' | 'production';
function detectEnvironment(): Environment {
const env = process.env.NODE_ENV || 'development';
const validEnvs: Environment[] = ['development', 'staging', 'production'];
return validEnvs.includes(env as Environment)
? (env as Environment)
: 'development';
}
export function getPerplexityConfig() {
const env = detectEnvironment();
const envConfig = require(`../../config/perplexity/${env}.json`);
return {
...baseConfig,
...envConfig,
environment: env,
};
}
Secret Management by Environment
Local Development
# .env.local (git-ignored)
PERPLEXITY_API_KEY=sk_test_dev_***
CI/CD (GitHub Actions)
env:
PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY_${{ matrix.environment }} }}
Production (Vault/Secrets Manager)
# AWS Secrets Manager
aws secretsmanager get-secret-value --secret-id perplexity/production/api-key
# GCP Secret Manager
gcloud secrets versions access latest --secret=perplexity-api-key
# HashiCorp Vault
vault kv get -field=api_key secret/perplexity/production
Environment Isolation
// Prevent production operations in non-prod
function guardProductionOperation(operation: string): void {
const config = getPerplexityConfig();
if (config.environment !== 'production') {
console.warn(`[perplexity] ${operation} blocked in ${config.environment}`);
throw new Error(`${operation} only allowed in production`);
}
}
// Usage
async function deleteAllData() {
guardProductionOperation('deleteAllData');
// Dangerous operation here
}
Feature Flags by Environment
const featureFlags: Record<Environment, Record<string, boolean>> = {
development: {
newFeature: true,
betaApi: true,
},
staging: {
newFeature: true,
betaApi: false,
},
production: {
newFeature: false,
betaApi: false,
},
};
Instructions
Step 1: Create Config Structure
Set up the base and per-environment configuration files.
Step 2: Implement Environment Detection
Add logic to detect and load environment-specific config.
Step 3: Configure Secrets
Store API keys securely using your secret management solution.
Step 4: Add Environment Guards
Implement safeguards for production-only operations.
Output
- Multi-environment config structure
- Environment detection logic
- Secure secret management
- Production safeguards enabled
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| Wrong environment | Missing NODE_ENV | Set environment variable |
| Secret not found | Wrong secret path | Verify secret manager config |
| Config merge fails | Invalid JSON | Validate config files |
| Production guard triggered | Wrong environment | Check NODE_ENV value |
Examples
Quick Environment Check
const env = getPerplexityConfig();
console.log(`Running in ${env.environment} with ${env.baseUrl}`);
Resources
Next Steps
For observability setup, see perplexity-observability.
04 同仓库更多 Skills
web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
neuropixels-analysis
Neuropixels neural recording analysis. Load SpikeGLX/OpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen/IBL curation, AI-assisted visual analysis, for Neuropixels 1.0/2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
notebooklm
Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.
slack-gif-creator
Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."