Skip to main content
Version: 1.x

Configuration

Introduction

The Coffee Shop Management System uses environment variables to configure the application. All settings are managed through Laravel's standard .env file.

If you've installed on a VPS, you should see a .env file in the root of the project (/home/coffeeshop/coffeeshop/.env). It is a normal Laravel env file which you can modify.

If you are using the Docker version, you need to update the environment variables of your container.

App URL

It is crucial to set the APP_URL environment variable to your Coffee Shop Management System URL to ensure that features like real-time order notifications and customer emails work properly.

APP_URL=https://your-coffeeshop-domain.com
ASSET_URL=https://your-coffeeshop-domain.com

Database Configuration

SQLite (Default for Development)

DB_CONNECTION=sqlite
DB_DATABASE=/var/www/html/database/database.sqlite
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=coffeeshop
DB_USERNAME=your_username
DB_PASSWORD=your_password

PostgreSQL

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=coffeeshop
DB_USERNAME=your_username
DB_PASSWORD=your_password

Email Configuration

To enable the Coffee Shop Management System to send emails to customers (order confirmations, receipts, notifications), you need to configure your mail server. Modify the following in the .env file:

MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@yourcoffeeshop.com
MAIL_FROM_NAME="${APP_NAME}"

Common Email Providers

Gmail/Google Workspace

MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls

SendGrid

MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_USERNAME=apikey
MAIL_PASSWORD=your_sendgrid_api_key

Mailgun

MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_USERNAME=postmaster@yourcoffeeshop.com
MAIL_PASSWORD=your_mailgun_password

After updating email settings, run the following commands to apply changes:

php artisan optimize:clear
php artisan optimize

For Docker version, you will need to restart/re-create the container.

Force HTTPS

To force HTTPS on your Coffee Shop Management System instance, set the FORCE_HTTPS environment variable to true in the .env file:

FORCE_HTTPS=true

This will activate URL::forceScheme('https') in the Laravel application, ensuring that all URLs generated by the application use HTTPS.

Coffee Shop Settings

Configure your coffee shop's basic information:

COFFEE_SHOP_NAME="Your Coffee Shop Name"
COFFEE_SHOP_ADDRESS="123 Coffee Street, City, State 12345"
COFFEE_SHOP_PHONE="+1-555-0123"
COFFEE_SHOP_CURRENCY=USD
COFFEE_SHOP_TIMEZONE=America/New_York

Payment Configuration

STRIPE_KEY=pk_test_your_stripe_public_key
STRIPE_SECRET=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret

Square

SQUARE_ACCESS_TOKEN=sq0atp_your_access_token
SQUARE_APPLICATION_ID=sq0idp_your_app_id
SQUARE_ENVIRONMENT=sandbox

Cache Configuration

For optimal performance, configure Redis for caching and real-time features:

CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

File Cache (Alternative)

CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file

Real-time Features Configuration

For live order updates and notifications:

BROADCAST_DRIVER=redis
PUSHER_APP_ID=your_pusher_app_id
PUSHER_APP_KEY=your_pusher_key
PUSHER_APP_SECRET=your_pusher_secret
PUSHER_HOST=laravel-websockets
PUSHER_PORT=6001
PUSHER_SCHEME=http

Logging Configuration

Configure application logging:

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Security Configuration

Enhance security with these settings:

SESSION_LIFETIME=120
SESSION_ENCRYPT=true
SESSION_SECURE=true
SESSION_HTTP_ONLY=true

Backup Configuration

Configure automated backups:

BACKUP_ENABLED=true
BACKUP_SCHEDULE="0 2 * * *"
BACKUP_RETENTION_DAYS=30
BACKUP_DISK=local

Testing Configuration

For development and testing environments:

APP_ENV=local
APP_DEBUG=true
TELESCOPE_ENABLED=false

Applying Configuration Changes

After modifying the .env file, always run these commands:

# Clear all caches
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear

# Optimize for production
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan optimize

# Restart queue workers if using queues
php artisan queue:restart

For Docker installations, restart the container to apply changes:

docker-compose down
docker-compose up -d

Environment-Specific Configurations

Development

APP_ENV=local
APP_DEBUG=true
LOG_LEVEL=debug
CACHE_DRIVER=file

Production

APP_ENV=production
APP_DEBUG=false
LOG_LEVEL=warning
CACHE_DRIVER=redis

Staging

APP_ENV=staging
APP_DEBUG=true
LOG_LEVEL=info
CACHE_DRIVER=redis

Your Coffee Shop Management System is now configured and ready for use!