-
Notifications
You must be signed in to change notification settings - Fork 167
Environment variables
Alessandro Fazzi edited this page Nov 27, 2019
·
1 revision
Wordmove allows the use of environment variables in your movefiles. This is useful in order to protect sensitive variables and credentials, as well as make it easy to share movefiles between your team.
Environment variables are written using the ERB tags syntax:
"<%= ENV['YOUR_SECRET_NAME'] %>"
Environment variables can be set up using two methods:
# bash
export PROD_DB_USER="username" PROD_DB_PASS="password"
# fish
set --export --global PROD_DB_USER "username"; set --export --global PROD_DB_PASS "password"
Wordmove supports the dotenv module.
Simply create a .env
file next to your movefile structured as follows:
PROD_DB_USER="username"
PROD_DB_PASS="password"
Wordmove will take care of loading the file and making the environment variables ready to be used in your configuration file.
You may also use .env.{environmentname}
, but this is discouraged.
Using the ERB syntax described above, write your movefile as follows:
production:
database:
user: "<%= ENV['PROD_DB_USER'] %>"
password: "<%= ENV['PROD_DB_PASS'] %>"
You can use system variables to configure your movefile.
For example:
local:
vhost: "http://wordpress-site.localhost"
wordpress_path: "<%= ENV['HOME'] %>/[wordpress directory path]/"
# wordpress_path will be substituted with /home/user_name/[wordpress directory path]