
Module 2 Lesson 3: n8n Configuration
Master the hidden settings. Explore the most important environment variables to control n8n's performance, security, and integration capabilities.
Module 2 Lesson 3: n8n Configuration
You can change almost every part of n8n's behavior using Environment Variables. These are usually set in your docker-compose.yml.
1. Timezone & Locale
The most common bug in automation is "The time is wrong."
environment:
- GENERIC_TIMEZONE=Europe/London # Ensure cron jobs run correctly
- TZ=Europe/London
2. Emails (SMTP)
If you want n8n to send you an email when a workflow fails, or if you want to use the "Forgot Password" feature:
environment:
- N8N_EMAIL_MODE=smtp
- N8N_SMTP_HOST=smtp.gmail.com
- N8N_SMTP_PORT=465
- N8N_SMTP_USER=myuser@gmail.com
- N8N_SMTP_PASS=app-password
3. Database (Postgres)
By default, n8n uses SQLite (a small file). This is bad for high-speed automation. For professional use, connect it to a real Postgres database.
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_HOST=postgres
4. Security & Authentication
N8N_ENCRYPTION_KEY: If you lose this, you lose all your credentials! Set this to a random 32-character string and save it in a password manager.N8N_AUTH_EXCLUDE_ENDPOINTS: Used to disable authentication for specific health checks.
Exercise: The Variable Mix
- Look at your
docker-compose.yml. Add theGENERIC_TIMEZONEfor your local area. - Setup a random
N8N_ENCRYPTION_KEY. - Research: What is the difference between
N8N_PORTand the Dockerports: ["5678:5678"]? - Why is using Postgres better than SQLite for a workflow that runs 100 times per minute?
- Search: How do you hide the "Registration" screen for new users once the main admin is setup?
Summary
Environment variables are the "DNA" of your n8n instance. By properly configuring your database, timezone, and security keys, you build an instance that is reliable, professional, and ready for production data.
Next Lesson: Going big: Scaling n8n: Worker Mode and Redis.