From 8f298eb8b5578e1540403422161c465fbc94b23b Mon Sep 17 00:00:00 2001 From: rderbier Date: Tue, 5 Nov 2024 14:55:58 -0800 Subject: [PATCH 1/8] add explanation about secrets in environment variables Update Note about secrets in connection. Add local dev option. Explain env variable keys naming convention and how to set them for `modus dev`. --- modus/app-manifest.mdx | 53 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index a9f1496c..f2351f4e 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -115,9 +115,13 @@ connection types: **Don't include secrets directly in the manifest!** If your connection requires authentication, you can include _placeholders_ in -connection properties which resolve to their respective secrets at runtime. Set -the actual secrets via the Hypermode Console, where they're securely stored -until needed. +connection properties which resolve to their respective secrets at runtime. + +When deployed on Hypermode, set the actual secrets via the Hypermode Console, +where they're securely stored until needed. + +When developing locally, +[set secrets using environment variables](#working-locally-with-secrets). @@ -324,6 +328,49 @@ This connection type supports connecting to Dgraph databases. You can use the The API key for the Dgraph database. +### Working locally with secrets + +When you run the app locally using `modus dev`, the runtime replaces all the +placeholders of the manifest with values from environment variables defined in +your operating system or in `.env` files. + +The environment variables keys must be upper case and follow the naming +convention: + +`MODUS__` + +For example, with the following manifest: + +```json modus.json +{ + "connections": { + "openai": { + "type": "http", + "baseUrl": "https://api.openai.com/", + "headers": { + "Authorization": "Bearer {{API_KEY}}" + } + } + } +} +``` + +Modus runtime substitutes `{{API_KEY}}` with the value of the environment +variable `MODUS_OPENAI_API_KEY` + +An easy way to define the environment variables when running `modus dev` is to +use the file `.env.dev.local` located in your app folder. + +For the previous manifest, we can set the key in the .env.dev.local file as +follow: + +```text .env.dev.local +MODUS_OPENAI_API_KEY="your actual openai key" +``` + +You must exclude `.env` files from your source control. `modus new` does that +automatically for you when creating the project. + ## Models AI models are a core resource for inferencing. The `models` object in the app From de1c2898b2ab6b445f5889da00a34968c47cdbd7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 6 Nov 2024 08:32:51 -0800 Subject: [PATCH 2/8] Update modus/app-manifest.mdx Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> --- modus/app-manifest.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index f2351f4e..a2a02251 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -330,7 +330,7 @@ This connection type supports connecting to Dgraph databases. You can use the ### Working locally with secrets -When you run the app locally using `modus dev`, the runtime replaces all the +When you run your app locally using `modus dev`, the runtime replaces the placeholders of the manifest with values from environment variables defined in your operating system or in `.env` files. From 9838d7966f0d4f742a2afb43cd759769a85604b6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 6 Nov 2024 08:33:12 -0800 Subject: [PATCH 3/8] Update modus/app-manifest.mdx Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> --- modus/app-manifest.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index a2a02251..b1aa460f 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -355,7 +355,7 @@ For example, with the following manifest: } ``` -Modus runtime substitutes `{{API_KEY}}` with the value of the environment +The Modus runtime substitutes `{{API_KEY}}` with the value of the environment variable `MODUS_OPENAI_API_KEY` An easy way to define the environment variables when running `modus dev` is to From 1cd4887c598a93c8bc7454283093e281b32f15bc Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 6 Nov 2024 08:33:33 -0800 Subject: [PATCH 4/8] Update modus/app-manifest.mdx Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> --- modus/app-manifest.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index b1aa460f..e3ce0c1f 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -358,7 +358,7 @@ For example, with the following manifest: The Modus runtime substitutes `{{API_KEY}}` with the value of the environment variable `MODUS_OPENAI_API_KEY` -An easy way to define the environment variables when running `modus dev` is to +An easy way to define the environment variables when working locally is to use the file `.env.dev.local` located in your app folder. For the previous manifest, we can set the key in the .env.dev.local file as From 1241b730f201030a533e1750ec9f2e99a0cc7b62 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 6 Nov 2024 08:33:43 -0800 Subject: [PATCH 5/8] Update modus/app-manifest.mdx Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> --- modus/app-manifest.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index e3ce0c1f..9046178a 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -365,7 +365,7 @@ For the previous manifest, we can set the key in the .env.dev.local file as follow: ```text .env.dev.local -MODUS_OPENAI_API_KEY="your actual openai key" +MODUS_OPENAI_API_KEY="your openai key" ``` You must exclude `.env` files from your source control. `modus new` does that From 6a4dd1e30e7619f9baa33bf81bd2433ab1ded34b Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 6 Nov 2024 08:34:05 -0800 Subject: [PATCH 6/8] Update modus/app-manifest.mdx Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> --- modus/app-manifest.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index 9046178a..288cac40 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -368,7 +368,7 @@ follow: MODUS_OPENAI_API_KEY="your openai key" ``` -You must exclude `.env` files from your source control. `modus new` does that +You should exclude `.env` files from source control. Projects created with `modus new` exclude these files automatically for you when creating the project. ## Models From 3fa2c63a3d0b502f040d3741ceca28adf08037ca Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 6 Nov 2024 08:34:18 -0800 Subject: [PATCH 7/8] Update modus/app-manifest.mdx Co-authored-by: Ryan Fox-Tyler <60440289+ryanfoxtyler@users.noreply.github.com> --- modus/app-manifest.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index 288cac40..3ae8cba9 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -369,7 +369,7 @@ MODUS_OPENAI_API_KEY="your openai key" ``` You should exclude `.env` files from source control. Projects created with `modus new` exclude these files -automatically for you when creating the project. +automatically when creating your project. ## Models From e40228e78b9f4d8623b99883b52dfad74df1fa08 Mon Sep 17 00:00:00 2001 From: rderbier Date: Wed, 6 Nov 2024 08:38:07 -0800 Subject: [PATCH 8/8] Update app-manifest.mdx --- modus/app-manifest.mdx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modus/app-manifest.mdx b/modus/app-manifest.mdx index 3ae8cba9..4e7db1d6 100644 --- a/modus/app-manifest.mdx +++ b/modus/app-manifest.mdx @@ -117,12 +117,12 @@ connection types: If your connection requires authentication, you can include _placeholders_ in connection properties which resolve to their respective secrets at runtime. -When deployed on Hypermode, set the actual secrets via the Hypermode Console, -where they're securely stored until needed. - When developing locally, [set secrets using environment variables](#working-locally-with-secrets). +When deployed on Hypermode, set the actual secrets via the Hypermode Console, +where they're securely stored until needed. + ### HTTP connection @@ -358,8 +358,8 @@ For example, with the following manifest: The Modus runtime substitutes `{{API_KEY}}` with the value of the environment variable `MODUS_OPENAI_API_KEY` -An easy way to define the environment variables when working locally is to -use the file `.env.dev.local` located in your app folder. +An easy way to define the environment variables when working locally is to use +the file `.env.dev.local` located in your app folder. For the previous manifest, we can set the key in the .env.dev.local file as follow: @@ -368,8 +368,8 @@ follow: MODUS_OPENAI_API_KEY="your openai key" ``` -You should exclude `.env` files from source control. Projects created with `modus new` exclude these files -automatically when creating your project. +You should exclude `.env` files from source control. Projects created with +`modus new` exclude these files automatically when creating your project. ## Models