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
-[Providing Variable Values from a Secrets Store](#providing-variable-values-from-a-secrets-store)
13
+
-[Providing Variable Values from the Environment](#providing-variable-values-from-the-environment)
14
+
-[Providing Variable Values on the Command Line](#providing-variable-values-on-the-command-line)
11
15
-[Troubleshooting](#troubleshooting)
12
16
13
17
Spin supports dynamic application variables. Instead of being static, their values can be updated without modifying the application, creating a simpler experience for rotating secrets, updating API endpoints, and more.
14
18
15
-
These variables are defined in a Spin application manifest (in the `[variables]` section), and their values can be set or overridden at runtime by an [application variables provider](./dynamic-configuration.md#application-variables-runtime-configuration). When running Spin locally, the variables provider can be [Hashicorp Vault](./dynamic-configuration.md#vault-application-variable-provider) for secrets, [Azure Key Vault](https://azure.microsoft.com/en-us/products/key-vault), or host environment variables.
16
-
17
-
For information about configuring application variables providers, refer to the [runtime configuration documentation](./dynamic-configuration.md#application-variables-runtime-configuration).
19
+
These variables are defined in a Spin application manifest (in the `[variables]` section), and their values can be set or overridden at runtime by an [application variables provider](./dynamic-configuration.md#application-variables-runtime-configuration), or the `--variable` flag to `spin up`. When running Spin locally, the variables provider can be [Hashicorp Vault](./dynamic-configuration.md#vault-application-variable-provider) for secrets, [Azure Key Vault](https://azure.microsoft.com/en-us/products/key-vault), or host environment variables. [See below](#setting-variable-values) for more information.
When you run an application, you must provide values for all required variables, and you may provide values for non-required variables (where you want to override the default). You can do this using a provider such as a secrets store, or you can set variables directly on the `spin up` command line.
283
+
284
+
### Providing Variable Values from a Secrets Store
285
+
286
+
You can provide variable values from a secrets store. The Spin CLI supports [Hashicorp Vault](./dynamic-configuration.md#vault-application-variable-provider) and [Azure Key Vault](https://azure.microsoft.com/en-us/products/key-vault). If you want to do this, you must set up the store in the runtime configuration file, and reference that file using `--runtime-config-file` on the command line.
287
+
288
+
For information about configuring application variables providers, refer to the [runtime configuration documentation](./dynamic-configuration.md#application-variables-runtime-configuration).
289
+
290
+
### Providing Variable Values from the Environment
291
+
292
+
You can provide variable values using the operating system environment. For each variable you want to set, you must specify an environment variable named `SPIN_VARIABLE_` followed by a "shouty capitalised" form of the variable name - that is, all uppercase, with underscores for separators. For example, to set the `database_username` variable:
You can provide variable values via the `spin up --variable` command line flag. This flag can be repeated, and supports several variants:
302
+
303
+
*`<key>=<value>`: sets the `<key>` variable to the given value
304
+
*`<key>=@<file>`: sets the `<key>` variable to the contents of the given text file
305
+
*`@<file>.json`: sets multiple variables - each `"<key>": "<value>"` pair in the given JSON file sets the `<key>` variable to the corresponding value
306
+
*`@<file>.toml`: sets multiple variables - each `<key> = "<value>"` pair in the given TOML file sets the `<key>` variable to the corresponding value
307
+
308
+
For example, suppose `secrets.json` is as follows:
309
+
310
+
```json
311
+
{
312
+
"sierra_madre": "no spoilers",
313
+
"eleven_herbs_and_spices": "you will never learn them from us"
314
+
}
315
+
```
316
+
317
+
Then `spin up --variable @secrets.json` will set the `sierra_madre` and `eleven_herbs_and_spices` variables. (Similarly with TOML files.)
318
+
319
+
For the `@<file>.json` and `@<file>.toml` variants, the file content must be string keys to string values. Numeric or object/table values are not allowed.
0 commit comments