Default SourceLair environment

SourceLair, depending on your project type, will inject the following environment variables in every process you run your project. Processes are your server, your terminal and any other commands that spawn a console window.

  • SL_PUBLIC_URL - your project’s public URL
  • SL_PROJECT - your project’s name
  • SL_ENV - in case you’d like to know if your code runs inside SourceLair
  • SL_SERVER - only your project’s server will have this
  • PORT - the exposed port that your server should listen to

Defining custom environment variables

Your project might need to have custom evnrinment variables defined, such as the database URL, or other configuration variables like creadentials etc. SourceLair supports dotenv configuration for your environment, meaning that you can create a .env file in your project - which should be ignored by .git - which can contain all these variables.

For example, if you’d like to configure the DATABASE_URL environment variable used for dynamically configuring your database connection using libraries such as dj-database-url and another variable called EMAIL_SECRET, you can create a .env file like the following: