Overview
Nguhöe EHR uses environment variables to configure application behavior across different environments. All configuration is managed through the.env file, which should never be committed to version control.
Getting Started
Copy the example environment file to create your configuration:Application Settings
The name of your application. Used in emails, notifications, and UI elements.
The application environment. Determines configuration behavior and error reporting.Options:
local, staging, productionApplication encryption key. Auto-generated with
php artisan key:generate. Required for session and data encryption.Enable detailed error messages and stack traces. Must be
false in production.The base URL of your application. Used for generating links and asset URLs.
Default application language.
Fallback language when the current language is unavailable.
Locale for generating fake data in development and testing.
Storage driver for maintenance mode state.Options:
file, databaseSecurity Settings
Number of bcrypt hashing rounds for password encryption. Higher values increase security but require more CPU.Recommended:
12 for productionDatabase Configuration
Database driver to use.Options:
sqlite, mysql, mariadb, pgsql, sqlsrvDatabase server hostname or IP address.
Database server port.Defaults: MySQL/MariaDB:
3306, PostgreSQL: 5432, SQL Server: 1433Name of the database. For SQLite, this is the path to the database file.
Database username for authentication.
Database password for authentication.
Session Configuration
Session storage driver.Options:
file, cookie, database, memcached, redis, arrayRecommended: database for productionSession lifetime in minutes. Users will be logged out after this period of inactivity.
Encrypt session data before storage. Adds security but slight performance overhead.
Cookie path for session. Usually the root path.
Cookie domain for session. Leave null for current domain.
Cache Configuration
Default cache storage driver.Options:
file, database, memcached, redis, arrayPrefix for cache keys to avoid collisions with other applications.
Queue Configuration
Queue driver for background job processing.Options:
sync, database, redis, sqs, beanstalkdRecommended: database for production, sync for local developmentMail Configuration
Mail transport driver.Options:
smtp, sendmail, mailgun, ses, postmark, logSMTP server hostname.
SMTP server port.Common ports:
25, 465 (SSL), 587 (TLS), 2525SMTP authentication username.
SMTP authentication password.
Default sender email address.
Default sender name.
Mail encryption protocol.Options:
tls, ssl, nullRedis Configuration
Redis client library.Options:
phpredis, predisRedis server hostname.
Redis authentication password.
Redis server port.
Logging Configuration
Default logging channel.Options:
stack, single, daily, slack, syslog, errorlogChannels to include in the stack.
Minimum log level to record.Options:
debug, info, notice, warning, error, critical, alert, emergencyRecommended: error for production, debug for developmentChannel for logging deprecation warnings.
File Storage Configuration
Default filesystem disk for file storage.Options:
local, public, s3Broadcasting Configuration
Broadcasting driver for real-time events.Options:
log, pusher, ably, redis, nullAWS Configuration
AWS access key ID for S3, SES, or other AWS services.
AWS secret access key.
AWS region for services.
S3 bucket name for file storage.
Vite Configuration
Application name exposed to the frontend build process.
Environment-Specific Configurations
Local Development
Staging Environment
Production Environment
Security Considerations
Production Security Checklist
- Set
APP_DEBUG=falseto prevent information leakage - Use strong, unique values for
APP_KEY - Enable HTTPS and set
APP_URLto usehttps:// - Use
BCRYPT_ROUNDS=12or higher for password hashing - Set appropriate
SESSION_LIFETIMEbased on your security requirements - Use
SESSION_ENCRYPT=truefor sensitive applications - Restrict database user permissions to only required operations
- Use strong database passwords
- Enable Redis authentication with
REDIS_PASSWORD - Set
LOG_LEVEL=errorto reduce disk usage - Review and remove unused AWS credentials
- Use environment-specific mail settings to prevent accidental emails
File Permissions
Ensure proper file permissions for the.env file:
Environment Variables in Code
Never use
env() helper directly in your application code. Always access environment variables through configuration files using config().Troubleshooting
Configuration Cache
In production, Laravel caches configuration for performance. After changing.env, clear the cache: