Module 2 Lesson 3: n8n Configuration
·Automation

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

  1. Look at your docker-compose.yml. Add the GENERIC_TIMEZONE for your local area.
  2. Setup a random N8N_ENCRYPTION_KEY.
  3. Research: What is the difference between N8N_PORT and the Docker ports: ["5678:5678"]?
  4. Why is using Postgres better than SQLite for a workflow that runs 100 times per minute?
  5. 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.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn