@@ -115,9 +115,13 @@ connection types:
115115** Don't include secrets directly in the manifest!**
116116
117117If your connection requires authentication, you can include _ placeholders_ in
118- connection properties which resolve to their respective secrets at runtime. Set
119- the actual secrets via the Hypermode Console, where they're securely stored
120- until needed.
118+ connection properties which resolve to their respective secrets at runtime.
119+
120+ When deployed on Hypermode, set the actual secrets via the Hypermode Console,
121+ where they're securely stored until needed.
122+
123+ When developing locally,
124+ [ set secrets using environment variables] ( #working-locally-with-secrets ) .
121125
122126</Warning >
123127
@@ -324,6 +328,49 @@ This connection type supports connecting to Dgraph databases. You can use the
324328 The API key for the Dgraph database.
325329</ResponseField >
326330
331+ ### Working locally with secrets
332+
333+ When you run the app locally using ` modus dev ` , the runtime replaces all the
334+ placeholders of the manifest with values from environment variables defined in
335+ your operating system or in ` .env ` files.
336+
337+ The environment variables keys must be upper case and follow the naming
338+ convention:
339+
340+ ` MODUS_<CONNECTION NAME>_<PLACEHOLDER> `
341+
342+ For example, with the following manifest:
343+
344+ ``` json modus.json
345+ {
346+ "connections" : {
347+ "openai" : {
348+ "type" : " http" ,
349+ "baseUrl" : " https://api.openai.com/" ,
350+ "headers" : {
351+ "Authorization" : " Bearer {{API_KEY}}"
352+ }
353+ }
354+ }
355+ }
356+ ```
357+
358+ Modus runtime substitutes ` {{API_KEY}} ` with the value of the environment
359+ variable ` MODUS_OPENAI_API_KEY `
360+
361+ An easy way to define the environment variables when running ` modus dev ` is to
362+ use the file ` .env.dev.local ` located in your app folder.
363+
364+ For the previous manifest, we can set the key in the .env.dev.local file as
365+ follow:
366+
367+ ``` text .env.dev.local
368+ MODUS_OPENAI_API_KEY="your actual openai key"
369+ ```
370+
371+ You must exclude ` .env ` files from your source control. ` modus new ` does that
372+ automatically for you when creating the project.
373+
327374## Models
328375
329376AI models are a core resource for inferencing. The ` models ` object in the app
0 commit comments