Environment Variables
Environment Variables and Configuration Options
Environment Variables
Complete reference for Wraft environment variables and configuration options
The .env File
We use environment variables to manage configuration. There is a file called .env.example
in the root directory of this project with all the environment variables set to empty values. You can set the correct values as per the following options. Once you set the values, you should rename the file to .env
before you start the server.
Application URLs - For frontend and backend (required)
Provide your Wraft domain URLs for frontend and backend services.
Secret key base
For production deployment, you have to set the following variables:
You can generate SECRET_KEY_BASE
using mix phx.gen.secret
command from the project root folder.
Guardian - Authentication
Configure Guardian for authentication:
Generate this using mix guardian.gen.secret
CLOAK_KEY - Sensitive data encryption
Generate this using openssl rand -base64 32
Mailer configuration
Application Mode
Database - PostgreSQL
Development Environment
Production Environment
Example: postgres://<username>:<password>@<host>:<port>/<database>
Phoenix - Application Server Configuration
MinIO - Object Storage
Configure MinIO for file storage:
Resend - Email Service
Visit https://resend.com to generate or manage your API key.
Optional - Admin Credentials
PDF Tools - File Paths
Sentry - Error Tracking
Typesense - Search Service
Signing - Digital Signature
Optional configuration for digital signatures:
xelatex variables
Configuration Examples
Development Environment
For local development, you can use the following minimal configuration:
Production Environment
For production deployment, ensure all required variables are properly configured:
Security Considerations
- Never commit sensitive environment variables to version control
- Use strong, unique secrets for production deployments
- Rotate secrets regularly for enhanced security
- Use environment-specific configurations for different deployment stages
- Validate all required variables are set before starting the application
Troubleshooting
If you encounter configuration issues:
- Check all required variables are properly set
- Verify database connectivity using the provided DATABASE_URL
- Ensure MinIO is accessible and credentials are correct
- Validate Typesense connection and API key
- Check application logs for specific error messages
For more detailed troubleshooting, see the Troubleshooting guide.