Environment variables are dynamic values defined during importer initialization and then can be accessed in the sheet configuration. They enable you to configure the environment of your importer.
The variable values passed during importer initialization will replace the placeholders referenced in the sheet settings using double curly braces.
Defining Environment Variables
Create an object environment.
Add the variables to this object in the <key>: <value> format.
Pass the environment object as a parameter to the importer initialization function.
Pass the environment object to the CSVBoxImporter function as shown below:
Minimum version 1.1.11 of the @csvbox/react library is required to use this feature.
Pass environment variables as an object to the environmentproperty of the CSVBoxButton component.
Minimum version 1.1.12 of the @csvbox/angular library is required to use this feature.
Pass environment variables as an object to the environmentproperty of the AppComponent.
Minimum version 1.1.8 of the @csvbox/vuejs library is required to use this feature.
Minimum version 1.1.5 of the @csvbox/vuejs3 library is required to use this feature.
Pass environment variables as an object to the environmentproperty of the CSVBoxButton component.
Environment variable names should not contain spaces and other special characters apart from _ (underscore).
The env_name variable name is a CSVbox reserved keyword that tags the environment. The import will be categorized in environment based on its value. You can pass values such as 'production', 'staging', 'local' to categorize the import. If no value is passed then the env_name variable will default to 'default' value. The individual imports can be filtered using the env_name inside CSVbox admin dashboard.
Filter via Environment on the Import page
Accessing the Variables
Environment variable values will replace all the environment placeholders mentioned in the sheet settings. The placeholders are defined using double curly brackets:
{{ environment_variable_name }}.
For instance, to reference an environment variable named "base_url," use the following syntax with double curly braces around the variable name:
{{base_url}}/route-endpoint
Using environment variables in the webhook URL allows you to dynamically adjust the webhook route based on the specific environment.
Defining Environment Placeholder
Apart from defining the environment, these variables can be used to dynamically configure the importer based on end users or any other system parameters. For example, you can define an environment variable user_id and pass it to the webhook URL to dynamically configure the URL based on the end user.
You can encrypt environment variables using the AES Everywhere library to protect sensitive data.
AES Everywhere Library
The AES Everywhere library provides a simple and effective way to encrypt and decrypt data using the Advanced Encryption Standard (AES) algorithm. It supports various platforms and programming languages, making it a versatile choice for securing environment variables.
CSVbox supports multiple encryption schemes for securing sensitive importer data at rest.
You can choose the mode that best fits your security or compliance requirements.
Supported Encryption Types
Encryption Mode
Notes
AES-256-CBC (legacy)
Still supported, but recommended to move to newer CBC/GCM variants.
Updated AES-256-CBC
Improved IV handling and hardened padding logic. Recommended if you prefer CBC mode.
AES-256-GCM
Most secure. Provides authenticity + integrity via GCM tags. Recommended for all new installs.