Environment Variables

Environment variables are dynamic values that are set outside of the main program and are used by various processes running on the SDK. These variables contain information about the system environment, such as the SHIMOKU_TOKEN, the UNIVERSE_ID or the WORKSPACE_ID, that are specific for every user and must not be shared.

Using a .env file, the values of the variables can be stored, and using a .gitignore file, the git processes will ignore them, thus will not publish them.


When creating a project in the SDK you will encounter a code similar to this:

main.py
from os import getenv
from shimoku import Client
from dotenv import load_dotenv

load_dotenv()

access_token = getenv('SHIMOKU_TOKEN')
universe_id: str = getenv('UNIVERSE_ID')
workspace_id: str = getenv('WORKSPACE_ID')

//[...]

The getenv() function returns the value of the variable stored in the .env file, indicated in the parameters:

.env
SHIMOKU_TOKEN=your_access_token_here
UNIVERSE_ID=your_universe_id_here
WORKSPACE_ID=your_workspace_id_here

To access these credentials, log into your account on Shimoku.io, click on the top-right corner User Icon and then on Settings > Information For Developers.

If you do not have an account, check Shimoku Cloud

Finally, to ensure that none of this values can be published when using git tools, create a .gitignore file and add the .env file:

.gitignore
# Ignore files containing sensitive environment variables
.env

# Ignore any other files or directories as needed
#[...]

Last updated