Notebooks

Environment Variables

Several times, you might need to set environment variables for your notebook applications such as API keys, secrets or other parameters that needs to be retrievable via the PHP getenv function. This can be easily done via the Environmental variables tab in the configurations options.

Environment variables

Default Environment variables

Some frameworks such as laravel and lumen skeleton has default environmental variables. These variables are automatically set for the notebook having default values same as those in the framework skeleton. Standard notebooks also come with two default variables which are the DB_DATABASE which stores the path to the sqlite database file and DB_CONNECTION which specifies the type of database connection being used. Any of these environmental variables can be changed to your desired value or removed completely.

Setting an Environment variable

New environmental variables can be added by using the form in the tab which requests for the name and value of the environmental variable. When a notebook is accessed by another user other than its owner, the environment variables are hidden . This also applies to when the notebook is forked. A checkbox is also provided which sets if the variable being added is required or not.
When a notebook with environmental variables set as required is forked by other users, it prompts them that an environmental variable needs to be set to use the notebook. A practical use case is when demonstrating how to use an API client which requires using API credentials from an API service. You can easily add such credentials as environment variables hence not risking others having access to it when they fork your notebook while they also get prompted that the credentials are required to run the notebook.

set environment variables

Updating an Environment variable

All environment variables that are set for a notebook are listed in the environment variables tab. By hovering over any of them, the edit icon will show. Clicking on the edit icon displays a form to update the name and value of the environment variable.

Update environment variables

Removing an environmental variable

Hovering over each environment variable shows a delete icon. clicking on the icon immediately deletes the environment variable.

Previous
Controls