Skip to main content
This guide covers all environment variables needed to configure Discord Webhook Manager.

Environment File Setup

The application uses a .env file for configuration. This file is created from .env.example:
cd /var/www/discord-webhook-manager/app
sudo cp .env.example .env
sudo nano .env
Never commit the .env file to version control. It contains sensitive credentials.

Core Application Settings

Application Configuration

# Application name (displayed in emails and UI)
APP_NAME=WebhookManager

# Environment: local, staging, production
APP_ENV=production

# Application key (generate with: php artisan key:generate)
APP_KEY=base64:your-generated-key-here

# Debug mode (MUST be false in production)
APP_DEBUG=false

# Your application URL
APP_URL=https://yourdomain.com
Never set APP_DEBUG=true in production. This exposes sensitive information in error messages.

Localization

# Application locale
APP_LOCALE=en

# Fallback locale
APP_FALLBACK_LOCALE=en

# Faker locale for testing
APP_FAKER_LOCALE=en_US

Logging

# Log channel: stack, single, daily, slack, syslog
LOG_CHANNEL=stack

# Stack configuration
LOG_STACK=single

# Log level: debug, info, notice, warning, error, critical, alert, emergency
LOG_LEVEL=error

# Deprecation warnings channel
LOG_DEPRECATIONS_CHANNEL=null
For production, use LOG_LEVEL=error to reduce log file size. Use daily channel for automatic log rotation.

Database Configuration

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=discord_webhook
DB_USERNAME=webhook_user
DB_PASSWORD=your_secure_password

MySQL Alternative

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=discord_webhook
DB_USERNAME=webhook_user
DB_PASSWORD=your_secure_password

SQLite (Development Only)

DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
SQLite is only suitable for local development. Use PostgreSQL or MySQL for production.

Redis Configuration

Redis is required for optimal performance:
# Redis client (phpredis recommended)
REDIS_CLIENT=phpredis

# Redis server
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

# Redis connections
REDIS_CACHE_CONNECTION=cache
REDIS_QUEUE_CONNECTION=default

Cache Configuration

# Cache driver: redis, database, file, memcached
CACHE_STORE=redis

# Optional cache prefix
# CACHE_PREFIX=webhook_
CACHE_STORE=redis

Queue Configuration

# Queue connection: redis, database, sync
QUEUE_CONNECTION=redis
Queue configuration is critical. Without a proper queue driver, scheduled messages will not be sent.
QUEUE_CONNECTION=redis

Session Configuration

# Session driver: redis, database, file, cookie
SESSION_DRIVER=redis

# Session lifetime (minutes)
SESSION_LIFETIME=120

# Encrypt session data
SESSION_ENCRYPT=false

# Session cookie path
SESSION_PATH=/

# Session cookie domain
SESSION_DOMAIN=null

# Redis connection for sessions
SESSION_STORE=redis

Mail Configuration

SMTP Configuration

# Mail driver: smtp, log, mailgun, ses, postmark, sendmail
MAIL_MAILER=smtp

# SMTP server details
MAIL_HOST=smtp.yourdomain.com
MAIL_PORT=587
MAIL_USERNAME=your_smtp_username
MAIL_PASSWORD=your_smtp_password
MAIL_ENCRYPTION=tls

# From address
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

Mail Service Examples

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=your-app-password
MAIL_ENCRYPTION=tls
Mail configuration is required for sending team collaboration invitations. In development, use MAIL_MAILER=log to log emails instead of sending them.

Optional Services

AI Content Generation

Enable AI-powered message content generation:
# OpenAI Configuration
OPENAI_API_KEY=sk-your-openai-api-key

# Google Gemini Configuration  
GEMINI_API_KEY=your-gemini-api-key
You only need to configure one AI provider. Users with can_use_ai flag enabled can generate content automatically.

Analytics (Matomo)

Optional analytics tracking:
# Matomo Tag Manager container URL
VITE_MATOMO_CONTAINER_URL=https://your-matomo-instance.com/js/container_XXXXXX.js

File Storage

# Filesystem disk: local, public, s3
FILESYSTEM_DISK=local
For scheduled message attachments, files are stored in storage/app/scheduled_messages/ by default.

AWS S3 (Optional)

If using S3 for file storage:
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your_bucket_name
AWS_USE_PATH_STYLE_ENDPOINT=false

Security Settings

Password Hashing

# BCrypt rounds (higher = more secure, slower)
BCRYPT_ROUNDS=12

Maintenance Mode

# Maintenance mode driver: file, cache
APP_MAINTENANCE_DRIVER=file

# Optional: store maintenance state in database
# APP_MAINTENANCE_STORE=database

Performance Tuning

PHP Workers

# Number of PHP CLI server workers (development only)
# PHP_CLI_SERVER_WORKERS=4

Broadcasting

# Broadcast driver: log, pusher, ably, redis, null
BROADCAST_CONNECTION=log

Memcached (Alternative Cache)

MEMCACHED_HOST=127.0.0.1

Frontend Configuration

Vite Variables

# Application name (available in React)
VITE_APP_NAME="${APP_NAME}"

# Matomo analytics (optional)
VITE_MATOMO_CONTAINER_URL=
Variables prefixed with VITE_ are exposed to the frontend JavaScript code.

Production Configuration Example

Here’s a complete production .env example:
# Application
APP_NAME=WebhookManager
APP_ENV=production
APP_KEY=base64:generated-key-here
APP_DEBUG=false
APP_URL=https://webhook.yourdomain.com

APP_LOCALE=en
APP_FALLBACK_LOCALE=en

BCRYPT_ROUNDS=12

# Logging
LOG_CHANNEL=daily
LOG_LEVEL=error
LOG_DEPRECATIONS_CHANNEL=null

# Database (PostgreSQL)
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=discord_webhook
DB_USERNAME=webhook_user
DB_PASSWORD=super_secure_password_here

# Redis
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_CACHE_CONNECTION=cache
REDIS_QUEUE_CONNECTION=default

# Cache & Queue
CACHE_STORE=redis
QUEUE_CONNECTION=redis

# Sessions
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_STORE=redis

# Mail (SMTP)
MAIL_MAILER=smtp
MAIL_HOST=smtp.yourdomain.com
MAIL_PORT=587
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=smtp_password_here
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

# File Storage
FILESYSTEM_DISK=local

# Broadcasting
BROADCAST_CONNECTION=log

# Frontend
VITE_APP_NAME="${APP_NAME}"

# Optional: AI Content Generation
# OPENAI_API_KEY=sk-your-key-here
# GEMINI_API_KEY=your-key-here

# Optional: Analytics
# VITE_MATOMO_CONTAINER_URL=https://matomo.yourdomain.com/js/container_XXXXX.js

Post-Configuration Steps

After editing .env, run these commands:
1

Clear configuration cache

php artisan config:clear
2

Cache configuration (production only)

php artisan config:cache
3

Restart services

# Restart PHP-FPM
sudo systemctl restart php8.2-fpm

# Restart queue workers
sudo supervisorctl restart all

Configuration Validation

Verify your configuration:
# Check database connection
php artisan migrate:status

# Check Redis connection
php artisan tinker
>>> Cache::get('test')
>>> exit

# Check queue connection
php artisan queue:monitor

Security Best Practices

Follow these security practices for production deployments:
  1. Use strong, unique passwords for all services
  2. Never set APP_DEBUG=true in production
  3. Keep .env file permissions restricted:
    chmod 600 .env
    chown www-data:www-data .env
    
  4. Use HTTPS for APP_URL
  5. Enable Redis password if exposed to network
  6. Regularly rotate API keys and passwords
  7. Backup .env file securely (encrypted)

Troubleshooting

Configuration Cached

If changes don’t take effect:
php artisan config:clear
php artisan cache:clear

Environment Variables Not Loading

Check file permissions:
ls -la .env
# Should be readable by www-data

Redis Connection Failed

Verify Redis is running:
redis-cli ping
sudo systemctl status redis-server

Next Steps

Build docs developers (and LLMs) love