-
Notifications
You must be signed in to change notification settings - Fork 0
Environment variables
wordmove-ng 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-ng 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-ng 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} (e.g. .env.production), loaded when that environment is selected with -e.
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]