Migrate Environment Variables #
Formatting Existing Environment Variables #
You can use the search + replace feature of your editor of choice to format your existing Environment Variables. We recommend using regexp search+replace with the following typical patterns.
Your Environment Variable Variable must be formatted in the following way: ENVKEY=ENVVALUE
Environment Variable Pattern | Regex Search | Replace |
---|---|---|
ENVKEY: ENVVALUE |
(:)+[ ]+ |
= |
ENVKEY= ENVVALUE |
(=)+[ ]+ |
= |
You need to escape all values with""
to avoid bash commands. You need to escape!
in values explicitly with\!
due to the bash bang command analogy.
Prepare Existing Environment Variables #
💡Feature in Development Due to the beta status of SetOps, we currently do not support multiple Environment Variables per command, so only one Environment Variable per command is allowed.
To speed up the migration, you can use multiline copy+pasting into the terminal. To prepare your commands, you can do the following: We came up with a best practice to migrate ENVs:
- Copy your existing Environment Variables
- Paste them in your editor of choice
- Format them in the way described above
- Add following line with multiline cursor
setops -p <PROJECT> -s <STAGE> --app <APPNAME> env:set
- Paste all commands in your terminal
- Commit the changeset:
setops -p <PROJECT> -s <STAGE> changeset:commit
- Check Environment Variables in your App:
setops -p <PROJECT> -s <STAGE> --app <APPNAME> env
Going further #
Read more about Environment Variables and how to set them in the Environment Variables Section.