Debian Codegraph @

docs/howto/prompt-user-for-variables.md

raw
1 # Prompt user for variables
2
3 With the use of [uservariables](../config/config-uservars.md),
4 one can define specific variables that need to be initially filled in manually
5 by the user on first run.
6
7 The provided values are then automatically saved by dotdrop to `uservariables.yaml`,
8 which can be included in the main config as a file from which variables are imported
9 using [import_variables](../config/config-config.md).
10
11 Let's say, for example, that you want to manually provide the email value
12 on new hosts you deploy your dotfiles to.
13
14 You'd add the following elements to your config:
15 ```yaml
16 uservariables:
17 emailvar: "email"
18 config:
19 import_variables:
20 - uservariables.yaml:optional
21 ```
22
23 On first run, the `emailvar` is prompted to the user and then saved
24 to `uservariables.yaml`. Since this file is imported, the value for
25 `emailvar` will automatically be filled in without prompting the
26 user on subsequent calls.