Skip to content

Environment Variables

For StudioCMS to work correctly, you must set up the correct environment variables. These variables are essential for establishing a secure connection to Astro DB and authenticating with the StudioCMS API. Without correctly configuring these environment variables, the application will not function as intended.

You can create a .env file in the root directory of your project and add the required environment variables. The .env file is a text file that contains key-value pairs of environment variables. The environment variables are read by the application at runtime.

For future reference on how to work with environment variables within Astro you can checkout Environment Variables^ from the Astro documentation.

In order to use StudioCMS, there are a few required environment variables that you must set up in your .env file.

Depending on the database you are using with StudioCMS, you will need to set up the appropriate environment variables for your database connection.

.env
CMS_LIBSQL_URL=libsql://your-database.turso.io
# CMS_LIBSQL_URL=file:./path/to/your/database.db
CMS_LIBSQL_AUTH_TOKEN=<your-auth-token> (optional)
CMS_LIBSQL_SYNC_INTERVAL= (optional)
CMS_LIBSQL_SYNC_URL= (optional)
.env
CMS_MYSQL_DATABASE=<your-database-name>
CMS_MYSQL_USER=<your-database-user>
CMS_MYSQL_PASSWORD=<your-database-password>
CMS_MYSQL_HOST=<your-database-host>
CMS_MYSQL_PORT=<your-database-port>
.env
CMS_PG_DATABASE=<your-database-name>
CMS_PG_USER=<your-database-user>
CMS_PG_PASSWORD=<your-database-password>
CMS_PG_HOST=<your-database-host>
CMS_PG_PORT=<your-database-port>

CMS_ENCRYPTION_KEY - A secure encryption key for encrypting sensitive data

.env
CMS_ENCRYPTION_KEY="wqR+w...sRcg=="