What are environment variables?
Environment variables are persistent variables that are available across your entire workspace. Typically, these are used to store things like external API keys or other sensitive information that you need to use across multiple function stacks, without storing it in a database table. Environment variables can be read in any logic or workflow, but they can not be modified from anywhere but this settings panel, so it’s best to only use them for things that you don’t need to change often.Adding Environment Variables
Click the icon in the upper-right corner to open Settings. On the next screen, click ‘Manage’ to edit your environment variables.
$env removes whitespace from its start and end, including a final line break; see Leading and trailing whitespace.

Using Environment Variables
Environment variables are available in any logic or workflow from a value dropdown under ENV.
Leading and trailing whitespace
The two ways of reading a variable treat whitespace differently.$env.NAME, which is what the ENV dropdown uses, removes whitespace from both ends of the value: spaces, tabs, line breaks (\nand\r), vertical tabs and NUL characters. Line breaks inside the value are kept, and other characters, such as a non-breaking space, are kept too. A value that is only whitespace reads as an empty string. This forgives a key pasted with a stray space or newline. The variable’s name is trimmed the same way.- Get Environment Variables (
util.get_envin XanoScript) returns every value exactly as it was saved, with nothing removed.
$pem_trimmed is the same key without its final line break. Read the value with util.get_env when the exact bytes matter: when you hash or sign the value itself, compare it byte for byte, or pass it to a system that requires the trailing newline, such as OpenSSH, which will not load a key in its own BEGIN OPENSSH PRIVATE KEY format without it.