Skip to content
Dropsolid Help Center home page
Product documentation
DevOps

Environment Variables

Environment Variables for Applications on Hosting Solutions

Applications hosted on our platform can utilize environment variables to manage configuration and operational settings. Among these variables, the DXP_VARIABLES environment variable is central, providing access to all tokens configured for a specific environment.

DXP_VARIABLES Overview

The DXP_VARIABLES environment variable is a Base64-encoded, JSON-formatted string. It encapsulates all token definitions from the Token Management UI, excluding the enclosing square brackets. These tokens are dynamically replaced during deployment and reflect the values defined at various levels (global, project, or environment).

To use this variable, follow these steps:

  1. Decode the Base64 string.
  2. Parse the resulting JSON string.
  3. Access the desired token values as key-value pairs in a dictionary or object.

Examples of Usage

Below are code snippets in popular programming languages and CLI to demonstrate how to decode and utilize DXP_VARIABLES:

PHP Example

// Decode and parse the DXP_VARIABLES
$DXP_VARIABLES = json_decode(base64_decode(getenv('DXP_VARIABLES')), true);
$database_name = $DXP_VARIABLES['database_name'];

Node.js Example

// Decode and parse the DXP_VARIABLES
const DXP_VARIABLES = JSON.parse(
Buffer.from(process.env.DXP_VARIABLES, 'base64').toString('utf-8')
);
const databaseName = DXP_VARIABLES.database_name;

CLI Example

# Decode and parse the DXP_VARIABLES
dxp_vars=$(echo $DXP_VARIABLES | base64 --decode)
database_name=$(echo $dxp_vars | jq -r .database_name)

Key Points

  • Dynamic Updates: The DXP_VARIABLES environment variable is regenerated during every deployment, ensuring it always reflects the latest token configurations.
  • Secure Access: Sensitive data stored as tokens is securely encrypted and decrypted only when accessed via the deployment process or environment variables.
  • Flexibility: This variable is compatible across multiple runtime environments, making it suitable for various frameworks and deployment strategies.

For more detailed information about tokens and their usage, refer to the Token Management documentation.

Send us your question

Do you still have unanswered questions or do you want to make some adjustments to your project? Don't hesitate to ask us your question at support@dropsolid.com or at +3293950290.