Skip to main content
Mercury Core uses environment variables to configure runtime settings that should not be committed to source control, such as passwords and server ports. Environment variables are typically stored in a .env file in the Site directory. An example file is provided at Site/.env.example.

Required Variables

ORIGIN
string
required
The full URL origin of your Mercury Core site, including the protocol.
ORIGIN=https://mercs.dev
PORT
number
required
The port on which the Mercury Core site will listen.
PORT=4443
EMAIL_PASSWORD
string
required
The password for authenticating with your SMTP server. This corresponds to the Username configured in the Email section of mercury.core.ts.
EMAIL_PASSWORD=password
Never commit this password to source control. Keep it secure in your .env file.
RCC_KEY
string
required
Authentication key for the RCC service proxy.
RCC_KEY=password
The password, port, and RCCService key may be changed if required.
GAMESERVER_KEY
string
required
Authentication key for gameserver communication.
GAMESERVER_KEY=password
OPEN_CLOUD_KEY
string
required
API key for Open Cloud services.
OPEN_CLOUD_KEY=whatever

Optional Variables

BODY_SIZE_LIMIT
string
Sets the maximum allowed size for request bodies. Useful for allowing large file uploads.See SvelteKit adapter-node documentation for details.
BODY_SIZE_LIMIT=1G

Example .env File

Here’s a complete example of a .env file:
ORIGIN=https://mercs.dev
PORT=4443
BODY_SIZE_LIMIT=1G
EMAIL_PASSWORD=password
RCC_KEY=password
GAMESERVER_KEY=password
OPEN_CLOUD_KEY=whatever

Security Best Practices

Never commit your .env file to version control. Ensure it’s included in your .gitignore file.
  1. Use strong, unique passwords for all authentication keys
  2. Rotate credentials periodically
  3. Limit access to the .env file on your server
  4. Use different credentials for development and production environments
  5. Consider using a secrets management service for production deployments

Loading Environment Variables

Mercury Core automatically loads environment variables from the .env file in the Site directory when the application starts. No additional configuration is needed. For production deployments, you may want to set environment variables directly in your hosting environment rather than using a .env file.

Build docs developers (and LLMs) love