envfly push
Add or update environment variables in your EnvFly project.Usage
Description
Thepush
command adds or updates environment variables in a specific environment. Variables are automatically encrypted and stored securely. This command is essential for:
- Initial Setup: Adding variables when setting up new environments
- Updates: Modifying existing variables with new values
- Bulk Operations: Importing multiple variables from files
- CI/CD: Automating environment variable management
Arguments
environment
environment
Type:
string
The target environment (e.g., development, staging,
production). bash envfly push development DATABASE_URL="postgresql://localhost:5432/dev" envfly push production API_KEY="prod_key_123"
variable
variable
Type:
string
The environment variable name. bash envfly push development DATABASE_URL="postgresql://localhost:5432/dev" # ^^^^^^^^^^^ ^^^^^^^^^^^^^ # environment variable
value
value
Type:
string
The environment variable value. bash envfly push development DATABASE_URL="postgresql://localhost:5432/dev" # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # value
Options
--file, -f
--file, -f
Type:
string
Push variables from a file (JSON, YAML, or .env format).envfly push development --file .env envfly push production -f
Examples
Basic Push
Push from File
Push from JSON
Push from YAML
Push from Environment
With Descriptions
Dry Run
Force Overwrite
File Formats
.env Format
JSON Format
YAML Format
Use Cases
Integration Examples
CI/CD Pipeline
Scripting
Team Collaboration
Error Handling
Environment Not Found
Environment Not Found
Error:
Environment 'production' not found
Solution: Create the
environment first: bash envfly init # Then push variables envfly push production DATABASE_URL="your-db-url"
Permission Denied
Permission Denied
Error:
Permission denied: Cannot push to environment 'production'
Solution: Check your team permissions or contact your admin.File Not Found
File Not Found
Error:
File '.env' not found
Solution: Ensure the file exists and
path is correct: bash ls -la .env envfly push development --file .env
Invalid File Format
Invalid File Format
Error:
Invalid file format. Supported: .env, .json, .yaml, .yml
Solution: Use supported file formats or check file syntax.Best Practices
Variable Naming
Variable Naming
- Use UPPER_CASE for environment variables - Use descriptive names (e.g.,
DATABASE_URL
notDB
) - Use consistent naming across environments - Prefix with environment if needed (e.g.,DEV_API_KEY
,PROD_API_KEY
)
Security
Security
- Never commit sensitive values to version control - Use different values for different environments - Rotate secrets regularly - Use descriptive names for audit purposes
Organization
Organization
- Group related variables together - Use consistent environment names - Document variable purposes with descriptions - Keep environment-specific variables separate