https://www.boundaryml.com logo
🟡 Passing secrets from GCP Secret Manager to clie...
# questions
d
Hey - any one know how I can pass secrets from gcp secret manager to clients.baml so it no longer users the .env in production? I have a workflow for this already for normal .ts scripts, but cant fingure out how to get this to work with BAML files
for anyone searching this, I think I've figured this out. you can create a custom client after generation and pass through any custom variables to the client options:
Copy code
const clientRegistry = new ClientRegistry()
clientRegistry.setPrimary("openai/gpt-4o-mini")
const env = {"BAML_LOG": "DEBUG", "OPENAI_API_KEY": "key-123"}
// Create client with default options
const myB = b.withOptions({ collector, clientRegistry, env })
// Uses the default options
const result = await myB.ExtractResume("...")
v
Yep! Also on loading your env vars, you can just set them in process.env and baml will just use that in subsequent calls automatically