Refactor out environment var and add RAILS_ENV to custom command