[interchange] * Add CounterDir configuration to allow counters to be defined

Mike Heins interchange-cvs at icdevgroup.org
Thu Feb 2 16:41:16 UTC 2017


commit 8397531ed92d33c07a06a028760f7dfbde30a861
Author: Mike Heins <mikeh at endpoint.com>
Date:   Thu Feb 2 11:33:54 2017 -0500

    * Add CounterDir configuration to allow counters to be defined
      by default in someplace different than VendRoot.
    
      Example:
    
         CounterDir   var/counters
    
      Note: You can make this work with existing Interchange catalogs that
      have counters in etc/ and logs/ if you do this script:
    
      	cd <vendroot>
      	mkdir var/counters
    	mv -f etc/*.number var/counters
    	mv -f etc/*.counter var/counters
    	mv -f log/*.number var/counters
    	mv -f log/*.counter var/counters
    	cd var/counters
    	ln -s . etc
    	ln -s . logs
    
      TODO: Should we auto-create directories?
    
    * Remove StaticDir directive, it's been ten years since this was
      needed. No longer referenced in any catalog template.

 lib/Vend/Config.pm      |    2 +-
 lib/Vend/Interpolate.pm |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/Vend/Config.pm b/lib/Vend/Config.pm
index 4ae3c3c..a6375cb 100644
--- a/lib/Vend/Config.pm
+++ b/lib/Vend/Config.pm
@@ -681,7 +681,7 @@ sub catalog_directives {
 	['TrackDateFormat',	 undef,     	     ''],
 	['SalesTax',		 undef,     	     ''],
 	['SalesTaxFunction', undef,     	     ''],
-	['StaticDir',		 undef,     	     ''],
+	['CounterDir',		 'relative_dir',     ''],
 	['SOAP',			 'yesno',			 'No'],
 	['SOAP_Enable',		 'hash',			 ''],
 	['SOAP_Action',		 'action',			 ''],				   
diff --git a/lib/Vend/Interpolate.pm b/lib/Vend/Interpolate.pm
index fb89ec8..ee3983f 100644
--- a/lib/Vend/Interpolate.pm
+++ b/lib/Vend/Interpolate.pm
@@ -2245,7 +2245,7 @@ sub tag_counter {
 		return undef;
 	}
 	
-    $file = $Vend::Cfg->{VendRoot} . "/$file"
+    $file = ($Vend::Cfg->{CounterDir} || $Vend::Cfg->{VendRoot}) . "/$file"
         unless Vend::Util::file_name_is_absolute($file);
 
 	for(qw/inc_routine dec_routine/) {



More information about the interchange-cvs mailing list