Environment-Specific Secret Values
Use a single secret with different values for each environment. KnoxCall automatically uses the correct value based on the route’s active environment—no manual switching required.The Problem
Traditional approach requires separate secrets per environment:- Accidental use of production keys in staging
- Manual route config updates when switching environments
- Difficult to audit which env uses which key
- Secret sprawl (3x secrets)
The Solution
One secret, multiple environment-specific values:- ✅ Automatic environment-based resolution
- ✅ Hard fail if environment value missing (prevents accidents)
- ✅ Simplified route configuration
- ✅ Clear audit trail per environment
How It Works
Step 1: Create Secret
Create a secret normally:Step 2: Configure Environment Values
In the secret detail page:- Select environment from dropdown (top right)
- Enter value for that environment
- Save
- Repeat for other environments
Step 3: Reference in Route
Use the secret in your route config:Step 4: Automatic Resolution
When a request comes in:Hard Fail Behavior
Safety feature: If a secret lacks a value for the requested environment, the request fails immediately.- Prevents accidental production key usage in dev/staging
- Forces explicit configuration
- Makes missing config obvious during testing
- Complies with principle of least privilege
Supported Secret Types
Environment-specific values work with all secret types:String Secrets
OAuth2 Secrets
Certificate Secrets (mTLS)
Advanced Usage
Partial Environment Coverage
You can configure only the environments you need:Duplicating Environments
Clone an existing environment’s value:- Go to secret detail page
- Select source environment (e.g., “production”)
- Click Duplicate to another environment
- Choose target environment (e.g., “staging”)
- Modify the duplicated value if needed
- Save
Deleting Environment Values
Protected deletion: Cannot delete an environment value if any route is actively using it in that environment.- Switch routes to different environment, OR
- Update routes to use different secret, OR
- Delete the routes first
Viewing All Environments
In the secret detail page, see all configured environments at a glance:API Reference
Get Secret Environments
Create/Update Environment Value
Delete Environment Value
Duplicate Environment
Migration Guide
From Naming Convention to Environment Configs
Before:- Create new secret:
stripe_api_key(no initial value) - Copy values:
- Environment: production → Paste value from
stripe_production_key - Environment: staging → Paste value from
stripe_staging_key - Environment: development → Paste value from
stripe_development_key
- Environment: production → Paste value from
- Update routes:
- Change
{{secret:stripe_production_key}}to{{secret:stripe_api_key}} - Remove environment-specific references
- Change
- Test in staging first
- Deploy to production
- Delete old secrets after 48 hours
Best Practices
✅ Do This
-
Use environment configs for new secrets
- Simpler, safer, better audit trail
-
Configure all environments you use
- Don’t leave gaps (hard fail protects you)
-
Test in staging first
- Verify correct values loaded per environment
-
Use descriptive names
stripe_api_keynotsecret_42- Easier to manage across environments
-
Document your environments
- Keep a list of which environments exist
- Standard: production, staging, development
❌ Avoid This
-
Don’t mix approaches for same service
- Either use env configs OR naming convention
- Don’t use both for Stripe (confusing)
-
Don’t delete environment values carelessly
- Check if routes are using them first
- System prevents deletion, but verify manually
-
Don’t share values across environments
- Never use production keys in staging
- Even if system allows it, don’t do it
-
Don’t skip testing after migration
- Always test in dev/staging first
- Verify hard fail works as expected
Troubleshooting
”Secret not configured for environment”
Problem:- Add the missing environment value
- Change route’s active environment
- Use a different secret that has the environment
Can’t delete environment value
Problem:Environment dropdown not showing
Problem: Can’t see environment selector in secret detail page Possible causes:- Secret type doesn’t support environments (shouldn’t happen - all types do)
- Browser cache issue - hard refresh (Ctrl+F5)
- Old UI version - ensure admin-ui is up to date
Wrong value being used
Problem: Route in staging is using production value Debug steps:- Check route’s active environment (top right dropdown)
- Verify secret has value for that environment
- Check route config uses correct secret name
- Test with a different route
Security Considerations
Encryption
All environment values are encrypted individually:Audit Trail
Every environment value change is logged:Access Control
- Only tenant admins can view/edit secret environment configs
- API requires authentication via JWT
- No way to retrieve values via API (write-only)
- Environment values never logged or transmitted in plaintext
Compliance
Environment-specific secrets help with:- PCI DSS: Separate production and test credentials
- SOC 2: Audit trail of secret changes per environment
- GDPR: Environment isolation for data protection
- HIPAA: Segregation of production and non-production
Next Steps
Creating Secrets
Learn how to create secrets in KnoxCall
Using Secrets in Routes
Reference secrets in route configurations
Environment Basics
Understand KnoxCall environments
Secret Rotation
Best practices for rotating secrets
📊 Guide Info
- Level: Intermediate
- Time: 10 minutes
- Prerequisites: Basic understanding of secrets and environments
🏷️ Tags
secrets, environments, configuration, security, credentials