The ability to import and export Environment variables was introduced in Frends 5.3.4
The ability to import Secret Environment variables was introduced in Frends 5.4.3
Exporting Environment variables
To the right of the "Create new" button, there is a dropdown button. Clicking on it reveals two options: "Import Environment variables" and "Export all Environment variables." In this case, we want to export all of our Environment variables shown on the left.
Note that Secret Environment variables will not be exported.
After clicking the "Export all Environment variables" option, your browser should download a .csv file called "exportEnvironmentVariableAll.csv." You can now make changes to the file and import it back into Frends.
Alternatively, you can export a single Environment variable by clicking the "Export Environment variable" button next to the Duplicate and Delete buttons. This will download a .csv file with only the one Environment variable.
Importing Environment variables
To import Environment variables, click the "Import Environment variables" button in the dropdown menu. A modal will appear with options regarding the import process.
Overwriting existing Environment variables
When enabled, the Environment variables you have in your .csv file will overwrite existing Environment variables with the same name.
Import Secret Environment Variables (introduced in Frends 5.4.3)
When enabled, Environment variables with the Type Secret will be allowed to be imported.
After configuring the import settings, click "Continue." Select your .csv file from the file selector, and Frends will start importing your Environment variables.
Modifying an exported Environment variable .csv file
When you open the .csv file that you exported, it will look something like this:
The file contains the name of the Environment variable, the Environment it belongs to, the type of the Environment variable, its value, and its description.
You can add new Environment variables by adding a new line in the format provided.
For example, if you want to add a new Environment variable called "connectionString" in all Environments except the "DefaultTest" Environment, you can add the following lines:
connectionString,Default,String,"""defaultlongconnectionstring.provider.com""",{}
connectionString,Core,String,"""corelongconnectionstring.provider.com""",{}
If you want to import multiple secrets into different Environments with comments for some, you can use a format like this:
secretVar,Default,Secret,"""secret value""","{""Text"":""This is an imported secret"",""Modifier"":""L3O\\berghda"",""Modified"":""2021-06-11T06:23:38""}"
secretVar,DefaultTest,Secret,"""secret value in the testing env""","{""Text"":""This is an imported secret"",""Modifier"":""L3O\\berghda"",""Modified"":""2021-06-11T06:23:38""}"
anotherSecret,Default,Secret,"""another secret value""",{}
anotherSecret,Core,Secret,"""another secret value in the core environment""",{}
thirdSecret,DefaultTest,Secret,"""secret""",{}
thirdSecret,Default,Secret,"""secret""",{}
Restrictions and things to keep in mind when importing Environment variables
Secrets will not be exported, but they can be added to a modified .csv file and imported if allowed in the import settings.
Changing the type of an Environment variable is not allowed.
If the Environment for an Environment variable does not exist in Frends, it will be skipped.
The modifier for the Environment variable import will be marked as the user who imported it.