Deploy Drupal variable changes with Hook Update Deploy Tools

If you are already using hook_update_N() in your custom deploy module or within a Feature to make related database changes across your development and production environments, it is an easy step to just use variable_set() to make settings changes without locking them into a Feature with strongarm.  The problem is, variable_set() runs silent.  It does not return any confirmation so you have no proof of what happened.  It also does not check to see if the variable you just set, is immediately overridden by the $conf in settings.php 

The module Hook Update Deploy Tools now has a method (as of version 7.x-1.5) to set Drupal variables and issue feedback as part of the update along with full logging via Watchdog.  Simply call the Settings::set() method from a hook_update_N() like this:

<?php
  $message
HookUpdateDeployTools\Settings::set('test_var_a', 'String A');
 
$message .=  HookUpdateDeployTools\Settings::set('test_var_b', 'String B');
  return
$message;
?>

Here is some sample output to yoru terminal after running `drush updb`:

Setting variables with hook_update_deploy_tools.

 

 

section: