Environment Variables Overview
Environment Variables are set at the beginning of a run for the current Vessel. These types of variables are the preferred way to pass secrets (password, API tokens, etc.) to scripts. Secrets required by your programs should never be hard-coded into the script. Instead, use Environment Variables to pass them to your script.
Environment Variables all have a Name and a Value. By referencing the variable's Name in your program, you can retrieve the Value. For more information, read our guide on how to access environment variable data with code or using the UI.
Environment Variables set in Shipyard are not visible in the UI and are encrypted on the backend. There are 3 distinct ways that your environment variable values can show up.
- Redacted - By default, anything you type will remain redacted and show as
- Visible - By clicking the eye icon, you can see the text that you just typed in.
- (Hidden) - By default, if you have previously saved sensitive information in an environment variable, we don't surface this value in the UI. This is done for security reasons so that the secrets are not downloaded to your browser and cannot be viewed by other users. You will only see environment variables that you typed in your current session.
When you first create Environment Variables, both the Name and Value fields should be filled out. To set a value as an empty string, type a single character and delete it to show
When editing environment variables in the future that show
(hidden), leaving the Value field blank will result in Shipyard continuing to use the previously set value for that Name.
Staying inline with programming best practices, we recommend that all of your environment variable names be in ALL CAPS, but Shipyard does not require it.
- Previously stored environment variables can never be viewed.
- Leaving an existing Name's value as blank will result in the value not updating. If you need to set a value to be blank, you will need to delete it, save the Vessel, then recreate the environment variable with a blank value.
- Because Vessels are containerized, the environment variables you set will only be available for that Vessel.