Configuration Guide
n8n-deploy offers multiple configuration methods to suit different environments and use cases.
🔧 Configuration Methods
1. CLI Flags
Highest priority configuration method.
n8n-deploy --server-url http://n8n.example.com:5678 wf list-server
2. Environment Variables
Second-highest priority configuration method.
# Set n8n server URL
export N8N_SERVER_URL=http://n8n.example.com:5678
# Set workflow directory
export N8N_DEPLOY_FLOW_DIR=/path/to/workflows
3. .env Files (Development Mode)
Lowest priority configuration method, only active in development mode.
# Copy .env.example to .env
cp .env.example .env
# Edit .env file
ENVIRONMENT=development
N8N_SERVER_URL=http://n8n.example.com:5678
N8N_DEPLOY_FLOW_DIR=/path/to/workflows
📋 Available Configuration Options
Server Configuration
--server-url/N8N_SERVER_URL- Specifies the n8n server URL for remote operations
- Example:
http://n8n.example.com:5678
Directory Configuration
--app-dir/N8N_DEPLOY_APP_DIR- Application data directory (database, backups)
- Default: Depends on system configuration
--flow-dir/N8N_DEPLOY_FLOW_DIR- Directory containing workflow JSON files
- Default: Current working directory
Environment Configuration
ENVIRONMENT- Set to
developmentto enable .env file loading - Default:
production(ignores .env files)
- Set to
Testing Configuration
N8N_DEPLOY_TESTING- Set to
1to prevent default workflow initialization during tests - Useful for test environments
- Set to
Script Sync Configuration
Used with wf push --scripts to sync external scripts to remote server.
Remote path: Scripts upload to <base-path>/<workflow-name>/
| CLI Flag | Environment Variable | Description | Default |
|---|---|---|---|
--scripts-host | N8N_SCRIPTS_HOST | Remote SSH host | (required) |
--scripts-user | N8N_SCRIPTS_USER | SSH username | (required) |
--scripts-port | N8N_SCRIPTS_PORT | SSH port | 22 |
--scripts-key | N8N_SCRIPTS_KEY | SSH key file path | (required) |
--scripts-base-path | N8N_SCRIPTS_BASE_PATH | Remote base directory | /opt/n8n/scripts |
Example:
export N8N_SCRIPTS_HOST=n8n.example.com
export N8N_SCRIPTS_USER=deploy
export N8N_SCRIPTS_KEY=~/.ssh/id_rsa
export N8N_SCRIPTS_BASE_PATH=/mnt/n8n/scripts
n8n-deploy wf push "My Workflow" --scripts ./scripts
🔍 Configuration Precedence
Configuration options are evaluated in this order:
- CLI Flags (Highest Priority)
- Environment Variables
- .env Files (Development Mode Only)
- Default Values (Lowest Priority)
💡 Pro Tips
- Use environment variables for persistent settings
- Use CLI flags for one-time overrides
- Keep sensitive information out of version control
- Use the
envcommand to view current configuration
# Show current configuration
n8n-deploy env
# Show configuration in JSON format
n8n-deploy env --json
🆘 Troubleshooting
- If a configuration seems incorrect, use
n8n-deploy envto verify - Check file paths and permissions
- Ensure API keys are correctly configured