You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/configuration.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,9 @@ sidebar_position: 225
6
6
7
7
# Configuration
8
8
9
-
Defang allows you to configure your application using environment variables. You can set environment variables in your [`compose.yaml` file](./compose.md), or in your [Pulumi program](./pulumi.md). Using Pulumi gives you the advantage of being able to manage your environment variables across different environments using Pulumi stacks.
9
+
Defang allows you to configure your application using environment variables. You can set environment variables in your [`compose.yaml` file](./compose.md), or in your [Pulumi program](#using-config-with-pulumi).
10
10
11
-
:::tip Sample
12
-
You can find a sample of how to set environment variables with Pulumi [here](https://github.com/DefangLabs/defang/tree/main/samples/nodejs/remix-aiven-postgres).
13
-
:::
14
-
15
-
# Sensitive Config aka Secrets
11
+
# Sensitive Config (aka Secrets)
16
12
17
13
The Defang CLI allows you to securely store sensitive information such as API keys, passwords, and other credentials. To do so, run:
18
14
@@ -44,6 +40,10 @@ services:
44
40
45
41
Use the `defang config` command of the Defang CLI to manage the values.
46
42
43
+
:::tip
44
+
You can find a sample of how to set sensitive config values [here](https://github.com/DefangLabs/samples/tree/main/samples/nodejs-openai).
45
+
:::
46
+
47
47
## Interpolation
48
48
49
49
Environment variables are set within the *environment* section of a service in a `compose.yaml` file. Any variables declared here will become available within the service container.
@@ -62,18 +62,24 @@ In the example above, if we assume the value of the configuration variable ***US
62
62
63
63
During `defang compose up` all variable references will be replaced with the actual value and made available in the container. If any referenced variable is not found the `defang compose up` command will be canceled.
64
64
65
+
## Using Config with Pulumi
66
+
In Defang, using config with [Pulumi](./pulumi.md) gives you the advantage of being able to manage your environment variables across different environments using Pulumi stacks.
67
+
68
+
:::tip
69
+
You can find a sample of how to set environment variables with Pulumi [here](https://github.com/DefangLabs/samples/tree/main/samples/pulumi-remix-postgres).
70
+
:::
71
+
65
72
## Connecting Services
66
73
67
74
If you have created a service before a secret you can connect it by running the `defang compose start` command if using the [`defang compose` workflow](./compose.md). If you are using the [Pulumi-based workflow](./pulumi.md) you will need to redeploy using Pulumi.
68
75
69
-
:::tip Sample
70
-
You can find a sample of how to set sensitive config values [here](https://github.com/DefangLabs/defang/tree/main/samples/nodejs/ChatGPT%20API).
71
-
:::
72
-
73
76
## Providers
74
77
75
78
Here are the different ways sensitive config values are stored depending on the provider you are using:
0 commit comments