Configuration
You now have the server and files setup, so we can get to configuring the basics. This guide will go over every line of the .env file.
Environment variables are stored securely in your .env file rather than the database to protect sensitive configuration.
Required Settings
License Key
LICENSE_KEY=- Get this from https://shadowdevs.com/license - it should be a simple string
- This is your license from Shadow Devs to use CDN Manager
- Required for the application to function
- Verified with a 72-hour grace period
Server Configuration
-
PORT=3001- The port your application will run on
- By default it's
3001, but you can change it to any valid port number - Make sure this port is not already in use
-
HOST=localhost- This modifies how SvelteKit interacts with the server
- Keep as
localhostunless you have specific networking requirements
-
BODY_SIZE_LIMIT=50000000000- Maximum request body size (50GB by default)
- This allows for large file uploads
- Adjust based on your maximum file size needs
Database
MONGO_URL=- The MongoDB connection URL for your database
- If you do not add any password lock to your database and leave it as local only, you can use:
mongodb://127.0.0.1:27017/cdnmanager - For production, consider using authentication:
mongodb://username:[email protected]:27017/cdnmanager
Domain Settings
-
ORIGIN=- Your full domain URL, including the protocol
- Example:
https://cdn.yourdomain.com - Must include
https://(orhttp://for development)
-
PUBLIC_DOMAIN=- Just your domain name without the protocol
- Example:
cdn.yourdomain.com - Used for email links and public CDN routes
Owner Permissions
OWNERS=["[email protected]"]- Must be a JSON array of email addresses
- Users who log in with these emails will have full owner permissions
- Example:
OWNERS=["[email protected]","[email protected]"] - These users bypass all permission checks
Email Configuration
CDN Manager uses email for authentication. You can use either SendGrid or SMTP.
Option 1: SendGrid (Recommended)
SENDGRID_KEY=- Head to the SendGrid API Keys page
- Create an API key with "Mail Send" permissions
- Copy and paste the key here
- If using SendGrid, you don't need to configure SMTP settings
Option 2: SMTP
If you're not using SendGrid, configure your SMTP server:
-
SMTP_HOST=- The host address for your SMTP server
- Example:
smtp.gmail.com - Set to
nullif using SendGrid
-
SMTP_PORT=- The port for your SMTP server
- Common ports:
587(TLS),465(SSL),25(unsecured) - Set to
nullif using SendGrid
-
SMTP_USER=- The email address or username for your SMTP server
- Example:
[email protected]
-
SMTP_PASS=- The password or app-specific password for your SMTP account
- For Gmail, use an app password
Email Fallback
If neither SendGrid nor SMTP are configured, CDN Manager will fall back to Shadow Devs' SMTP server. For production use, we recommend configuring your own email service.
Complete Example
Here's a complete .env file example:
# License (REQUIRED)
LICENSE_KEY=your-license-key-here
# Server Configuration
PORT=5173
HOST=localhost
BODY_SIZE_LIMIT=5368709120
# Database
MONGO_URL=mongodb://127.0.0.1:27017/cdnmanager
# Domain Settings
ORIGIN=https://cdn.yourdomain.com
PUBLIC_DOMAIN=cdn.yourdomain.com
# Owner Permissions
OWNERS=["[email protected]"]
# Email Configuration (SendGrid)
SENDGRID_KEY=SG.your-sendgrid-key-here
# Email Configuration (SMTP) - Leave as null if using SendGrid
SMTP_HOST=null
SMTP_PORT=null
SMTP_USER=
SMTP_PASS=