Using Team Variables
Factorial Code team variables allow you to define key-value pairs for use in process source code. These variables are versatile, serving purposes such as storing configuration parameters used across various processes or safeguarding sensitive information like passwords or API keys (using the secured flag).
When you click on the New icon, you can specify the variable name and value, and check whether it is secured.
To use these team variables in process source code, you may use just plain JavaScript or Python env vars syntax (or use the fcode.env approach):
const apiKey = process.env.KRAKEN_API_KEY;// orconst apiKey = fcode.env.KRAKEN_API_KEY;api_key = os.getenv("KRAKEN_API_KEY")# orapi_key = fcode.env.KRAKEN_API_KEYSubsequently, apiKey will contain the value defined in the team variable regardless of whether it was marked as secured or not. Exercise caution to avoid logging or transmitting it from the code.
Inherited variables
Section titled “Inherited variables”A workspace can also use the variables defined in its parent workspaces — see workspace hierarchy. They show up in the variables list marked with the workspace they come from, and any process running here reads them exactly like its own.
Inherited variables are read-only here: they belong to the workspace that defines them, so they are edited or deleted there. To change one just for this workspace, use Override here (or create a variable with the same key): from then on your value is the one processes see, and the inherited entry disappears from the list. Removing your override brings the parent’s value back.
Secured variables inherit too. Their values are never readable through the UI, the API or the CLI — neither yours nor the ones you inherit — but they are available to your processes at execution time.
Team variables are also how you protect a webhook. A webhook — or the
whole workspace, through
webhook authentication — names the variable holding the
token it expects. Callers send that value as an Authorization: Bearer token by default, or as the
raw value of a custom header. Only the variable name is stored with the process, so the token stays
out of exports and out of the files the CLI commits.