Set Environment Variables
Environment Variables in BAML
Environment variables are primarily used in clients to propagate authorization credentials, such as API keys, like so:
Setting Environment Variables in Python/Typescript/etc
The generated BAML client will capture all environment variables when you import it, and will not be able to see any environment variables you load after importing the BAML client.
Any of the following strategies are compatible with BAML:
- set environment variables in your
Dockerfile
- set environment variables in your
next.config.js
- set environment variables in your Kubernetes manifest
- load environment variables from secrets-store.csi.k8s.io
- load environment variables from a secrets provider such as Infisical / Doppler
- dotenv (
.env
file) cli (e.g.dotenv -e .env python myscript.py
) - using account credentials for ephemeral token generation (e.g. Vertex AI Auth Tokens)
If BAML doesn’t work for your use case, please contact us!
Modifying env variables in your program
This is available in Baml Version 0.57+
We do not currently support any other mechanisms for providing authorization credentials, including but not limited to:
- fetching credentials from a secret storage service, such as AWS Secrets Manager or HashiCorp Vault
Please contact us if you need support for these use cases.