When we want to pin a variable for an environment, we'll set the value in the admin, then go look it up in the database, and copy the name and value into a bash or phing script, to insure that that variable is always set to the appropriate value for the environment.

However, for complex variables, such as options lists, what should set string look like? For example node_export_file_types looks like this in the database:


if we wanted to set that using drush vset node_export_file_types 'somestring' what that 'somestring' look like?

1 Answer 1


You can use drush.

drush vget foo --pipe

The --pipe option will format the output as php code.

As far as using that with drush vset, I would recommend against that and instead set via an update hook, or directly in settings.php.

  • Thanks, I'd overlooked --pipe, and it is a really helpful piece of the the puzzle. I can live with setting complex vars in an update hook, but here's the inconvenience: we've started implementing config management with drush tasks in phing, but stuff complex vars in code; can we call a function from drush, so at least we can fire it from a phing build script, I wonder?
    – August1914
    Commented Jun 5, 2013 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.