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 URL and Token for @astrojs/db
Section titled “Database URL and Token for @astrojs/db”ASTRO_DB_REMOTE_URL
- The connection URL to your libSQL serverASTRO_DB_APP_TOKEN
- The app token for your libSQL server
ASTRO_DB_REMOTE_URL=libsql://your.server.ioASTRO_DB_APP_TOKEN=eyJh...RUCg
@astrojs/db
see, the Astro docs for Astro DB^ Encryption Key for @studiocms/auth
Section titled “Encryption Key for @studiocms/auth”CMS_ENCRYPTION_KEY
- A secure encryption key for encrypting sensitive data
CMS_ENCRYPTION_KEY="wqR+w...sRcg=="
Optional Environment Variables
Section titled “Optional Environment Variables”oAuth Authentication Environment Variables
Section titled “oAuth Authentication Environment Variables”For more information about setting up oAuth authentication, see the Configure oAuth Authentication documentation.
GitHub (Optional)
Section titled “GitHub (Optional)”To authenticate with GitHub, you need to add the following environment variables to your .env
file:
# credentials for GitHub OAuthCMS_GITHUB_CLIENT_ID=CMS_GITHUB_CLIENT_SECRET=CMS_GITHUB_REDIRECT_URI=
Discord (Optional)
Section titled “Discord (Optional)”# credentials for Discord OAuthCMS_DISCORD_CLIENT_ID=CMS_DISCORD_CLIENT_SECRET=CMS_DISCORD_REDIRECT_URI=
Google (Optional)
Section titled “Google (Optional)”# credentials for Google OAuthCMS_GOOGLE_CLIENT_ID=CMS_GOOGLE_CLIENT_SECRET=CMS_GOOGLE_REDIRECT_URI=
Auth0 (Optional)
Section titled “Auth0 (Optional)”# credentials for auth0 OAuthCMS_AUTH0_CLIENT_ID=CMS_AUTH0_CLIENT_SECRET=CMS_AUTH0_DOMAIN=CMS_AUTH0_REDIRECT_URI=
Image Handler Environment Variables
Section titled “Image Handler Environment Variables”Cloudinary (Optional)
Section titled “Cloudinary (Optional)”If you choose to use the built-in Cloudinary plugin, you will need to define the following:
## Cloudinary Javascript SDKCMS_CLOUDINARY_CLOUDNAME="demo"