Add Custom Environment Variables
Introduction
Custom environment variables allow you to define configuration values specific to your deployment. These variables can
be used to set API keys, connection strings, or other parameters that your application or connectors need. When you run
the ddn connector env add
command, it automatically updates multiple files to ensure the environment variables are
available across your project:
.env
: Adds the variable to the current context's environment configuration file for easy access during development.connector.yaml
: Updates the connector's configuration to include the variable for deployment.compose.yaml
: Ensures the variable is included in the Docker Compose configuration for runtime.
Add an environment variable
From a project directory, run:
ddn connector env add <connector_name> --env FOO=bar
Repeat these steps for each additional variable.
Use an environment variable
After creating a new build and running your connector, you can access your environment variable(s) via whatever conventions your language of choice prefers. For detailed instructions, refer to the following resources:
- Node.js: Using dotenv
- Python: Using python-dotenv
- Go: Using godotenv