Environment Variable Configuration
wukong-deploy supports managing sensitive information and environment-specific settings through environment variables.
Basic Usage
Use environment variables in the configuration file:
// config.mjs
export default {
servers: {
prod: {
host: '127.34.5.53',
username: 'root',
passwordEnv: 'PROD_SERVER_PASSWORD', // .env PROD_SERVER_PASSWORD="yourpassword"
},
},
};
Environment Variable Files
wukong-deploy supports .env
files:
# .env
PROD_SERVER_PASSWORD=your-secure-password
Configuration Priority
The loading priority of environment variables (from highest to lowest) is:
- Command-line arguments
- Environment variables
.env
Security Recommendations
- Do not commit
.env
files to version control - Use
.env.example
as a template - Set appropriate file permissions
- Regularly update keys and passwords