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.
Required Environment Variables
Section titled “Required Environment Variables”In order to use StudioCMS, there are a few required environment variables that you must set up in your .env file.
Database connection
Section titled “Database connection”Depending on the database you are using with StudioCMS, you will need to set up the appropriate environment variables for your database connection.
libSQL
Section titled “libSQL”CMS_LIBSQL_URL=libsql://your-database.turso.io# CMS_LIBSQL_URL=file:./path/to/your/database.dbCMS_LIBSQL_AUTH_TOKEN=<your-auth-token> (optional)CMS_LIBSQL_SYNC_INTERVAL= (optional)CMS_LIBSQL_SYNC_URL= (optional)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>PostgreSQL
Section titled “PostgreSQL”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>Encryption Key for studiocms
Section titled “Encryption Key for studiocms”CMS_ENCRYPTION_KEY - A secure encryption key for encrypting sensitive data
CMS_ENCRYPTION_KEY="wqR+w...sRcg=="You can generate a secure encryption key using the following command:
openssl rand --base64 16