Permalink
Fetching contributors…
Cannot retrieve contributors at this time
2885 lines (1949 sloc) 104 KB
!init OPT_LOOK="icdevgroup"; OPT_STYLE="manual"
# $Id: icconfig.sdf,v 1.82 2004-05-05 15:22:30 jon Exp $
!define DOC_NAME "Configuration Reference"
!define DOC_TYPE ""
!define DOC_CODE "icconfig"
!define DOC_VERSION substr('$Revision: 1.82 $',11, -2)
!define DOC_STATUS "Draft"
!define DOC_PROJECT "Interchange"
!define DOC_URL "http://www.icdevgroup.org/doc/icconfig.html"
!build_title
H1: Interchange Configuration Files
This is an alphabetical reference to the configuration directives used in Interchange global and catalog configuration files.
Interchange has multiple catalog capability, and therefore splits its configuration into two pieces. One is global, C<interchange.cfg>, and affects every catalog running under it. The other, C<catalog.cfg> is specific to an individual catalog, and has no effect on other catalogs.
H2: Directive syntax
Configuration directives are normally specified with the directive as the first word on the line, with its value or values following. Capitalization of the directive name is not significant. Leading and trailing whitespace is stripped from the line.
LI1: Including files in directives
Additional files may be called with an include file notation like this:
!block example;
DirectiveName <includefile
!endblock
Files included from interchange.cfg are relative to the Interchange software directory. Files included from catalog.cfg are relative to the catalog directory.
LI1: Here documents
A "here document" can be used to spread directive values over several lines, with the usual Perl <<MARKER syntax. No semicolon is used to terminate the marker. The closing marker must be the only thing on the line. No leading or trailing characters are allowed, not even whitespace. Here is a hypothetical directive using a here document:
!block example; listitem=2
DirectiveName <<EOD
setting1
setting2
setting3
EOD
!endblock
That is equivalent to:
!block example; listitem=2
DirectiveName setting1 setting2 setting3
!endblock
LI1: Include single setting from file
.Value can be pulled from a file with <file:
!block example; listitem=2
Variable MYSTUFF <file
!endblock
.This works well for includes that must be of the highest possible performance. They can be simply placed in a page with __VARIABLE__.
LI1: include
.Other configuration files can be included in the current one. For example, common settings can be set in one file:
!block example; listitem=2
include common.cfg
!endblock
.Or all files in one directory:
!block example; listitem=2
include usertag/*
!endblock
LI1: ifdef and ifndef
.ifdef/endif and ifndef/endif pairs can be used:
!block example; listitem=2
Variable ORDERS_TO email_address
ifdef ORDERS_TO
ParseVariables Yes
MailOrderTo __ORDERS_TO__
ParseVariables No
endif
ifdef ORDERS_TO =~ /foo.com/
# Send all orders at foo.com to one place now
# Set ORDERS_TO to stop default setting
Variable ORDERS_TO 1
MailOrderTo orders@foo.com
endif
ifdef ORDERS_TO eq 'nobody@nowhere.com'
# Better change to something else, set ORDERS_TO to stop default
Variable ORDERS_TO 1
MailOrderTo someone@somewhere.com
endif
ifndef ORDERS_TO
#Needs to go somewhere....
MailOrderTo webmaster@localhost
endif
!endblock
H1: interchange.cfg
The VendRoot directory, specified in the main program C<interchange>, is the default location of all of the Interchange program, configuration, special, and library files. Unless changed in the call to C<interchange>, the main Interchange server configuration file will be C<interchange.cfg> in the VendRoot directory.
The directives defined in C<interchange.cfg> affect the entire Interchange server and all catalogs running under it. Multiple Interchange servers may be run on the same machine with totally independent operation.
Following is an alphabetical listing of all global configuration directives.
H2: AcceptRedirect *global*
Enables processing of HTTP server redirects, i.e. when handling ErrorDocument
for Apache. For instance, if you have in Apache httpd.conf:
!block example
## Setting in httpd.conf
ErrorDocument 404 /cgi-bin/foundation
!endblock
At that point, a request for /somedir/index.html that is not found will be
equivalent to /cgi-bin/foundation/somedir/index.html and will be
indistinguishable from the Apache-served page by the client.
!block example
AcceptRedirect Yes
!endblock
A Yes/No directive, default C<No>.
Caution should be taken not to enable the ErrorDocument to redirect to
Interchange globally -- it would render you subject to a
denial-of-service attack at random URLs, i.e. a flood of MS Windows
"Code Red" attacks. It is recommended that you enable it only for
specific directories, as Apache or another HTTP server will stand up
much better under such a flood.
H2: ActionMap *global*
Allows setting of Interchange form actions, usually with a Perl subroutine.
Actions are page names like:
!block example
process Perform a processing function
order Order items
scan Search based on path info
search Search based on submitted form variables
!endblock
The global version of ActionMap applies to all catalogs. If the same
action is specified in C<catalog.cfg>, it will pertain. See C<ActionMap>
in that section.
H2: AddDirective *global*
Adds a configuration directive that will be parsed for every C<catalog.cfg> file. Accepts three parameters: the name of the directive, the name of the parser (if any), and the default value (if any). The following definition would add a directive "Foo," with parser "parse_bar," and a default value of "Hello, world!":
!block example
AddDirective Foo bar "Hello, world!"
!endblock
If the parser is not defined, the directive value will be scalar and the same as what the user passes in the config file. If defined, the parser must be extant before it can be referenced, is always resident in Vend::Config, and begins with the string C<parse_>.
H2: AllowGlobal *global*
Specifies catalog identifiers that may define subroutines and UserTag entries
that can operate with the full permissions of the server. {{B:Don't use this
unless the catalog user is trusted implicitly.}} Default is blank.
!block example
AllowGlobal simple
!endblock
Using AllowGlobal is never necessary, and is always dangerous in a multi-user
environment. Its use is not recommended.
H2: AutoVariable *global*
Specifies directives which should be translated to Variable settings. For
scalars, the directive name becomes the Variable name and yields its value,
i.e. C<ErrorFile> becomes C<__>C<ErrorFile__>, which would by
default be C<error.log>. Array variables have a C<_N> added, where C<_N> is
the ordinal index, i.e. C<SafeUntrap> becomes C<__>C<SafeUntrap_0__>,
C<__>C<SafeUntrap_1__>, etc. Hash variables have a _KEY added, i.e.
C<SysLog> becomes C<__>C<SysLog_command__>,
C<__>C<SysLog_facility__>, etc. Doesn't handle hash keys that have non-word
characters or whitespace. Only single-level arrays and hashes are translated
properly.
See C<AutoVariable> in C<catalog.cfg>.
H2: Capability *global*
Just like Require or Suggest, but can never cause a warning or message. This
allows a module to be loaded if available and for a program to check for
that capability later and adapt itself to the configuration.
!block example
Capability module Archive::Zip
!endblock
H2: Catalog *global*
Specifies a catalog that can run using this Interchange server. This directive
is usually inserted into C<interchange.cfg> by the makecat program when you
build a new catalog.
There are three required parameters, as shown in this example:
!block example
Catalog simple /home/interchange/simple /cgi-bin/simple
!endblock
The first is the name of the catalog. It will be referred to by that name in error, warning, and informational messages. It must contain only alphanumeric characters, hyphens, and underscores. It is highly recommended that it be all lower case.
The second is the base directory of the catalog. If the directory does not contain a C<catalog.cfg> file, the server will report an error and refuse to start.
The third is the C<SCRIPT_NAME> of the link program that runs the catalog. This is how the catalog is selected for operation. Any number of alias script names may be specified as additional parameters. This allows the calling path to be different while still calling the same catalog:
!block example
Catalog simple /home/interchange/simple /cgi-bin/simple /simple
!endblock
This is useful when calling an SSL server or a members-only alias that requires a username/password via HTTP Basic authorization. All branched links will be called using the aliased URL.
The script names must be unique among CGI program paths that run on this server; the same name cannot be used for more than one catalog unless the C<FullURL> directive is specified. In this case, the parameter may be specified as:
!block example; listitem=2
www.yourcompany.com/cgi-bin/simple
www.theirs.com/cgi-bin/simple
!endblock
Each of those 'simple' catalogs would then call a different catalog.
Optionally, individual C<Catalog> directives that specify each of the different parameters may be used. The equivalent of our original example directive above is:
!block example
Catalog simple directory /home/interchange/simple
Catalog simple script /cgi-bin/simple
Catalog simple alias /simple
!endblock
Global directives may be specified that will change for that catalog only. This is mostly useful for C<ErrorFile> and C<DisplayErrors>:
!block example
Catalog simple directive ErrorFile /var/log/interchange/simple_error.log
!endblock
H2: CheckHTML *global*
Set to the name of an external program that will check the user's HTML when they set C<[flag checkhtml]> or C<[tag flag checkhtml][/tag]> in their page.
!block example
CheckHTML /usr/local/bin/weblint
!endblock
H2: CodeDef *global*
A generic subroutine mapper that allows mapping of a subroutine as a
{{CMD[jump="icconfig.html#ActionMap *global*"]ActionMap}},
CoreTag,
{{CMD[jump="icconfig.html#Filter"]Filter}},
{{CMD[jump="icconfig.html#FormAction *global*"]FormAction}},
{{CMD[jump="icconfig.html#GlobalSub *global*"]GlobalSub}},
{{CMD[jump="icconfig.html#ItemAction"]ItemAction}},
LocaleChange,
OrderCheck,
{{CMD[jump="icconfig.html#UserTag *global*"]UserTag}},
Widget.
H2: ConfigAllAfter *global*
The name of a file (or files) which should be read as a part of every catalog's configuration, after any other configuration files are read. Default is C<catalog_after.cfg>.
!block example
ConfigAllAfter check_actions.cfg check_variables.cfg
!endblock
H2: ConfigAllBefore *global*
The name of a file (or files) which should be read as a part of every catalog's configuration, before any other configuration files are read. Default is C<catalog_before.cfg>.
!block example
ConfigAllBefore set_actions.cfg set_variables.cfg
!endblock
H2: ConfigParseComments *global*
Set to No if you want old-style '#include', '#ifdef', or '#ifndef' to be treated as the comments they appear to be. The default is Yes, which means both '#include' and 'include' do the same thing. (Use a space after the '#' if you really want to comment out the command.)
Interchange prior to version 4.7 used a different syntax for meta-directives 'include', 'ifdef', and 'ifndef' in configuration files. The commands were borrowed from the C preprocessor, and true to their C heritage, they started with '#': '#include', '#ifdef', '#ifndef'. Interchange configuration files, unlike C, uses '#' to begin one-line comments, which meant that a newcomer at first glance might assume that:
!block example
#Variable DEBUG 1
#include more.cfg
!endblock
were both comments, when in fact the second was a live #include command.
To begin to make things more consistent, Interchange 4.7 and up now recognize those meta-directives without the leading '#', and the included demo catalog sets this directive to No so that lines beginning with '#' really are skipped as comments, regardless of what comes after.
H2: Database *global*
Defines a database which is global and available to all catalogs. Writing can
be controlled by catalog. See C<Database>.
H2: DataTrace *global*
Set DBI to trace at the level specified. Valid values are:
0 - Trace disabled.
1 - Trace DBI method calls returning with results or errors.
2 - Trace method entry with parameters and returning with results.
3 - As above, adding some high-level information from the driver
and some internal information from the DBI.
4 - As above, adding more detailed information from the driver.
Also includes DBI mutex information when using threaded Perl.
5 and above - As above but with more and more obscure information.
Trace level 1 is best for most Interchange debug situations. Trace will only be enabled when C<DebugFile> is specified, as that file is the target for the trace. Example:
E: DataTrace 1
Default is 0. Directive added in 4.7.0.
H2: DebugFile *global*
Names a file, relative to the Interchange root directory, which should store
the output of C<logDebug> statements, and warnings if warnings are enabled.
!block example
DebugFile /tmp/icdebug
!endblock
H2: DeleteDirective *global*
Deletes a configuration directive from the list is parsed for every
C<catalog.cfg> file. Can save memory for installations with large numbers
of catalogs.
!block example
DeleteDirective DescriptionField OfflineDir
!endblock
The directive is not case-sensitive. Has no effect on global directives.
H2: DisplayErrors *global*
While all errors are reported in the error log file, errors can also be displayed by the browser. This is convenient while testing a configuration. Unless this is set, the C<DisplayErrors> setting in the user catalogs will have no effect. Default is No.
!block example
DisplayErrors Yes
!endblock
Note: This changes the value of $SIG{__DIE__} and may have other effects
on program operation. This should NEVER be used for normal operation.
H2: DomainTail *global*
Implements the domain/IP session qualifiers so that only the major domain is used to qualify the session ID. This is a compromise on security, but it allows non-cookie-accepting browsers to use multiple proxy servers in the same domain. Default is Yes.
!block example
DomainTail No
!endblock
If encrypting credit cards with PGP or GPG, or are using a payment service like CyberCash, look at the C<WideOpen> directive, which enables more browser compatibility at the cost of some security.
H2: DumpStructure *global*
Tells Interchange to dump the structure of catalogs and the Interchange server
to a file with the catalog name and the extension C<.structure>. Use this to see how directives have been set.
H2: EncryptProgram *global*
Specifies the default encryption program that should be used to encrypt
credit card numbers and other sensitive information. Default is C<gpg>
if found on the system; then C<pgpe>, if found; then C<pgp>, and finally
C<none>, disabling encryption.
This is used to set the default in C<catalog.cfg>, which has its own independent
setting of C<EncryptProgram>.
H2: Environment *global*
Environment variables to inherit from the calling CGI link program. An example might be PGPPATH, used to set the directory which PGP will use to find its key ring.
!block example
Environment MOD_PERL REMOTE_USER PGPPATH
!endblock
H2: ErrorFile *global*
Sets the name of the global error log. The default is C<error.log> in the
Interchange software directory.
!block example
ErrorFile /var/log/interchange/log
!endblock
Of course, the user ID running the Interchange server must have permission to
write that file.
Optionally, syslog error logging can be set up as well. See C<SysLog>.
H2: FormAction *global*
Allows a form action (like the standard ones C<return, submit, refresh,> etc.) to be set up. It requires a Perl subroutine as a target:
!block example
FormAction foo <<EOR
sub {
$CGI->{mv_nextpage} = 'bar';
}
EOR
!endblock
If it returns a true (non-zero, non-empty) value, Interchange will display
the page defined in $CGI->{mv_nextpage}. Otherwise, Interchange will
not display any page. The default Interchange actions can be overridden,
if desired. There is also a catalog-specific version of this directive,
which overrides any action of the same name.
The global version affects all catalogs -- there is also a
catalog-specific version of FormAction which is protected by Safe.
H2: FullUrl *global*
Normally Interchange determines which catalog to call by determining the
SCRIPT_NAME from the CGI call. This means that different (and maybe virtual)
hosts cannot use the same SCRIPT_NAME to call different catalogs. Set
C<FullUrl> to Yes to differentiate based on the calling host. Then, set the
server name in the Catalog directive accordingly, such as
C<yourdomain.com/cgi-bin/simple>. A yes/no directive, the default is No.
!block example
FullUrl Yes
!endblock
If it is set in this fashion, C<all> catalogs must be defined in this fashion. NOTE: The individual catalog setting will not work, as this is used before the catalog name is known.
H2: GlobalSub *global*
Defines a C<global> subroutine for use by the C<[perl sub] subname arg /perl]>
construct. Use the "here document" capability of Interchange configuration
files to make it easy to define:
!block example
GlobalSub <<EOF
sub count_orders {
my $counter = new File::CounterFile "/tmp/count_orders", '1';
my $number = $counter->inc();
return "There have been $number orders placed.\n";
}
EOF
!endblock
As with Perl "here documents," the EOF (or other end marker) must be the ONLY thing on the line, with no leading or trailing white space. Do not append a semicolon to the marker. (The above marker appears indented. It should not be that way in the file!)
IMPORTANT NOTE: These global subroutines are not subject to security checks. They can do most anything! For most purposes, scratch subroutines or catalog subroutines (also Sub) are better.
C<GlobalSub> routines are subject to full Perl use strict checking, so errors are possible if lexical variables or complete package qualifications are not used for the variables.
H2: HammerLock *global*
The number of seconds after which a locked session could be considered to be
lost due to malfunction. This will kill the lock on the session. Only here for
monitoring of session hand-off. If this error shows up in the error log, the
system setup should be examined. Default is 30.
!block example
HammerLock 60
!endblock
This mostly doesn't apply to Interchange when using the default file-based
sessions.
H2: HitCount *global*
Increments a counter in C<ConfDir> for every access to the catalog. The
file is named C<hits.catalogname>, where C<catalogname> is the short
catalog identifier. A Yes/No directive, default is C<No>.
!block example
HitCount Yes
!endblock
H2: HouseKeeping *global*
How often, in seconds, the Interchange server will "wake up" and look for user
reconfiguration requests and hung search processes. On some systems, this
wakeup is the only time the server will terminate in response to a stop
command. Default is 60.
!block example
HouseKeeping 5
!endblock
H2: Inet_Mode *global*
Determines whether INET-domain sockets will be monitored on startup.
Overridden by the command-line parameter C<-i>. Default is C<Yes>.
H2: IpHead *global*
Implements the domain/IP session qualifiers so that only the first C<IpQuad>
dot-quads of the IP address are used to qualify the session ID. The default is
1. This is a slight compromise on security, but it allows non-cookie-accepting
browsers, like AOL's V2.0, to use multiple proxy servers.
C<DomainTail> is preferable unless one of your HTTP servers does not do host
name lookups. Default is C<No>, and DomainTail must be set to C<No> for it to
operate.
!block example
IpHead Yes
!endblock
H2: IpQuad *global*
The number of dot-quads that IpHead will look at. Default is 1.
!block example
IpQuad 2
!endblock
H2: Locale *global*
Sets the global C<Locale> for use in error messages. Normally set from a
file's contents, as in the example before:
!block example
Locale <locale.error
!endblock
H2: LockoutCommand *global*
The name of a command (as it would be entered from the shell) that will lock out the host IP of an offending system. The IP address will be substituted for the first occurrence of the string %s. This will be executed with the user ID that Interchange runs under, so any commands that require root access will have to be wrapped with an SUID program.
On Linux, a host may be locked out with:
!block example
ipfwadm -I -i deny -S %s
!endblock
This would require root permissions, however, under normal circumstances. Use C<sudo> or another method to wrap and allow the command.
A script can be written which modifies an appropriate access control file, such as .htaccess for your CGI directory, to do another level of lockout. A simple command line containing C<perl -0777 -npi -e 's/deny/deny from %s\ndeny/' /home/me/cgi-bin/.htaccess> would work as well (remember, the %s will become the IP address of the offending user).
!block example
LockoutCommand lockout %s
!endblock
H2: LockType *global*
Allows selection of file locking method used throughout Interchange. Options are 'flock', 'fcntl', and 'none'. Added in 4.7.0. Please note that due to a bug this directive only works in Interchange 4.8.6 and above.
Default is flock. See the flock(2) manpage for details.
The fcntl setting is needed for NFS filesystems; for NFS-based locking to work, the NFS lock daemon (lockd) must be enabled and running on both the NFS client and server. Locking with fcntl works on Linux and should work on Solaris, but is not guaranteed to work on all OSes.
The none setting turns off file locking entirely, but that is never recommended. It might be useful to check if locking is causing hangs on the system.
If you are only accessing sessions on an NFS-mounted directory but the rest of Interchange is on the local filesystem, you can instead set the SessionType catalog directive to 'NFS', which enables fcntl locking for sessions only on a per-catalog basis.
H2: Mall *global*
Set to C<Yes> to issue cookies only for the current catalog's script. By
default, when Interchange issues a cookie it does so for the base
domain. This will allow multiple catalogs to operate on the same domain
without interfering with each others session ID.
A yes/no directive.
!block example
Mall Yes
!endblock
H2: MaxRequestsPerChild *global*
The maximum number of requests a page server will handle before it commits
suicide and asks for a replacement server. This prevents runaway memory leaks.
!block example
MaxRequestsPerChild 100
!endblock
Default is 50. Only applies in {{CMD[jump="icconfig.html#PreFork *global*"]PreFork}} mode.
H2: MaxServers *global*
The maximum number of servers that will be spawned to handle page
requests. If more than MaxServers requests are pending, they will be
queued (within the defined capability of the operating system, usually
five pending requests) until the number of active servers goes below
that value.
!block example
MaxServers 4
!endblock
Default is 10.
H2: NoAbsolute *global*
Whether Interchange C<[file ...]> and other tags can read any file
on the system (that is readable by the user id running the Interchange
daemon). The default is No, which allows any file to be read. This should
be changed in a multi-user environment to minimize security problems.
!block example
NoAbsolute Yes
!endblock
Note that this does not apply to tests for whether a file exists, as
with C<[if file ...]>. Such operations are allowed regardless of the
C<NoAbsolute> setting.
H2: PIDcheck *global*
If non-zero, enables a check of running Interchange processes during
the housekeeping routine. If a process has been running (or is hung)
for longer than PIDcheck seconds then a kill -9 will be issued and the
server count decremented. During the housekeeping routine, the number
of servers checked by C<MaxServers> will be recounted based on PID files.
Default is 0, disabling the check.
!block example
PIDcheck 300
!endblock
If you have long-running database builds, this needs to be disabled. Set it
to a high value (perhaps 600, for 10 minutes), or use the offline script.
H2: PIDfile *global*
The file which will contain the Interchange server process ID so that
it can be read to determine which process should be sent a signal for
stopping or reconfiguring the server.
!block example
PIDfile /var/run/interchange/interchange.pid
!endblock
This file must be writable by the Interchange server user ID.
H2: PreFork *global*
Causes Interchange to run in pre-forking server mode, where a number of
Interchange server daemons (defined in
{{CMD[jump="icconfig.html#StartServers *global*"]StartServers}}) will be
pre-spawned to handle page requests. Each server will handle the number
of requests defined in
{{CMD[jump="icconfig.html#MaxRequestsPerChild *global*"]MaxRequestsPerChild}}
before committing suicide and causing another server to pre-fork to replace it.
!block example
PreFork Yes
!endblock
This reduces system overhead due to forking and is the fastest and
best way to run a busy Interchange server.
settings that will apply for all catalogs.
A yes/no directive, default is C<No>.
H2: Profiles *global*
Names a file (or files) which contain C<OrderProfile> and C<SearchProfile>
settings that will apply for all catalogs.
!block example
Profiles etc/profiles.common
!endblock
H2: RobotIP *global*
The RobotIP directive defines a list of IP numbers which will be classed as
crawler robots (search engines) and causes Interchange to alter its
behavior to improve the chance of Interchange-served content being crawled
and listed.
The directive accepts a wildcard list - * represents any number of
characters, ? represents a single character. The elements of the list are
separated by a comma.
See {{CMD[jump="icconfig.html#RobotUA *global*"]RobotUA}} for a full description of the behavioural changes.
\Example:
!block example
RobotIP 209.135.65, 64.172.5
!endblock
H2: RobotUA *global*
The RobotUA directive defines a list of User Agents which will be classed as
crawler robots (search engines) and causes Interchange to alter its
behavior to improve the chance of Interchange-served content being crawled
and listed.
The directive accepts a wildcard list - * represents any number of
characters, ? represents a single character. The elements of the list are
separated by a comma.
If a User Agent is recognised as a robot, the following will be performed by Interchange:
=over 4
* C<mv_tmp_session> scratch variable is set to 1, causing sessions to be
disabled and therefore avoiding the writing of session data to disk.
* C<mv_no_session_id> scratch variable is set to 1, causing Interchange to
generate URLs without a session id (eg. C<mv_session_id=KvWna2PT>).
* C<mv_no_count> scratch variable is set to 1, causing Interchange to
generate URLs without an incremental number, normally used to prevent
proxy caching (eg. C<mv_pc=4>).
=back
It should be noted that once you have identified you are serving a page to a
robot, you should not use this to massively alter your page content in an
attempt to improve your ranking. If you do this, you stand the chance of
being blacklisted. You have been warned!
\Example:
!block example
RobotUA Inktomi, Scooter, *Robot*, *robot*, *Spider*, *spider*
!endblock
See also {{CMD[jump="icconfig.html#RobotIP *global*"]RobotIP}}.
H2: SafeUntrap *global*
Sets the codes that will be untrapped in the C<Safe.pm> module and used
for embedded Perl and conditional operations. View the Safe.pm
documentation by typing C<perldoc Safe> at the command prompt. The
default is C<ftfile sort>, which untraps the file existence test
operator and the sort operator. Define it as blank to prevent any
operators but the default restrictive ones.
!block example
SafeUntrap ftfile sort ftewrite rand
!endblock
H2: SendMailProgram *global*
Specifies the program used to send email. Defaults to '/usr/lib/sendmail'. If it is not found at startup, Interchange will return an error message and refuse to start.
!block example
SendMailProgram /bin/mailer
!endblock
A value of 'none' will disable the sending of emailed orders. Orders must be read from a tracking file, log, or by other means.
H2: SOAP *global*
If set to Yes, allows handling of SOAP rpc requests.
H2: SOAP_Host *global*
The list of hosts that are allowed to connect to for SOAP rpc requests. Default
is C<localhost 127.0.0.1>.
H2: SOAP_MaxRequests *global*
The maximum number of requests a SOAP rpc server will handle before it commits
suicide and asks for a replacement server. This prevents runaway memory leaks.
H2: SOAP_Perms *global*
The permissions that should be set on a SOAP UNIX-domain socket. Default is
C<0660>, which allows only programs running as the same UID as Interchange
to access the socket.
H2: SOAP_Socket *global*
A list of sockets which should be monitored for SOAP requests. If they
fit the form NNN.NNN.NNN.NNN:PPPP, they are IP addresses and ports for
monitoring INET-domain sockets, any other pattern is assumed to be a file
name for monitoring in the UNIX domain.
!block example
SOAP_Socket 12.23.13.31:7770 1.2.3.4:7770 /var/run/interchange/soap
!endblock
H2: SOAP_StartServers *global*
The number of SOAP servers which should be started to handle SOAP
requests. Default is 1.
!block example
SOAP_StartServers 10
!endblock
H2: SocketFile *global*
The name of the file which is used for UNIX-domain socket communications. Must
be in a directory where the Interchange user has write permission.
!block example
SocketFile /var/run/interchange/interchange.socket
!endblock
Default is C<etc/socket> or the value of the environment variable MINIVEND_SOCKET. If set, it will override the environment. It can be set on the command line as well:
!block example
bin/interchange -r SocketFile=/tmp/interchange.socket
!endblock
H2: SocketPerms *global*
The permissions (prepend a 0 to use octal notation) that should be used for the UNIX-domain socket. Temporarily set this to 666 on the command line to debug a permission problem on C<vlink>.
!block example
bin/interchange -r SocketPerms=0666
!endblock
H2: StartServers *global*
The number of Interchange page servers which should be started to handle
page requests when in {{CMD[jump="icconfig.html#PreFork *global*"]PreFork}} mode.
Default is 1.
!block example
StartServers 8
!endblock
H2: SubCatalog *global*
Allows definition of a catalog which shares most of the characteristics of
another catalog. Only the directives that are changed from the base catalog
are added. The parameters are: 1) the catalog ID, 2) the base catalog ID, 3) the directory to use (typically the same as the base catalog), and 4) the SCRIPT_NAME that will trigger the catalog. Any additional parameters are aliases for the SCRIPT_NAME.
The main reason that this would be used would be to conserve memory in a series of stores that share most of the same pages or databases.
!block example
SubCatalog sample2 sample /usr/catalogs/sample /cgi-bin/sample2
!endblock
H2: SysLog *global*
Set up syslog(8) error logging for Interchange.
!block example
SysLog command /usr/bin/logger
SysLog tag int1
SysLog alert local3.warn
SysLog warn local3.info
SysLog info local3.info
SysLog debug local3.debug
!endblock
This would cause global errors to be logged with the command:
!block example
/usr/bin/logger -t int1 -p local3.alert
!endblock
and cause system log entries something like:
!block example
Oct 26 17:30:11 bill int1: Config 'co' at server startup
Oct 26 17:30:11 bill int1: Config 'homefn' at server startup
Oct 26 17:30:11 bill int1: Config 'simple' at server startup
Oct 26 17:30:11 bill int1: Config 'test' at server startup
Oct 26 17:30:13 bill int1: START server (2345) (INET and UNIX)
!endblock
This would work in conjunction with a UNIX syslogd.conf entry of:
!block example
# Log local3 stuff to Interchange log
local3.* /var/log/interchange.log
!endblock
A custom wrapper can be created around it to get it to behave as desired. For instance, if you didn't want to use syslog but instead wanted to log to a database (via DBI), you could create a Perl script named "logdatabase" to log things:
!block example
#!/usr/bin/perl
my $script_name = "logdatabase";
use DBI;
use Getopt::Std;
getopts('d:p:T:k:')
or die "$script_name options: $@\n";
use vars qw/$opt_d $opt_p $opt_T $opt_k/;
my $dsn = $opt_d || $ENV{DBI_DSN};
my $template = $opt_T
|| "insert into log values ('~~KEY~~', '~~LEVEL~~', '~~MSG~~')";
my $dbh = DBI->connect($dsn)
or die "$script_name cannot connect to DBI: $DBI::errstr\n";
my %data;
$data{KEY} = $opt_k || '';
local ($/);
$data{MSG} = <>;
$data{LEVEL} = $opt_p || 'interchange.info';
$template =~ s/\~\~(\w+)\~\~/$dbh->quote($data{$1})/;
my $sth = $dbh->prepare($template)
or die "$script_name error executing query: $template\n";
$sth->execute()
or die "$script_name error executing query: $template\n";
exit;
!endblock
H2: TagDir *global*
Defines the directory or directories that Interchange will scan
for tag, filter, widget, and other code declarations.
!block example
TagDir code etc/other_code
!endblock
Relative to the Interchange software root. Default is C<code>.
H2: TagGroup *global*
Defines a group of tags for possible inclusion or exclusion in the set
of ITL tags Interchange will compile and use.
!block example
TagGroup :file "counter file include log value_extended"
EOF
!endblock
Default is defined in lib/Vend/Config.pm, and is too lengthy
to show here. Above is the default :file group.
H2: TagInclude *global*
Includes or excludes a set of IC tags for compilation and
use. The {{CMD[jump="#CodeDir"]TagDir}} is scanned for files,
and when found they are checked against tag names and the groups
defined in .{{CMD[jump="icconfig.html#TagGroup"]TagGroup}}.
!block example
TagInclude ALL !:crufty !get_url
!endblock
The above will include all tags by default, but not the group C<:crufty>
nor the tag C<get_url>.
Default is ALL.
H2: TcpHost *global*
When running in INET mode, using C<tlink>, specifies the hosts that are
allowed to send/receive transactions from any catalog on this Interchange
server. Can be either an name or IP number, and multiple hosts can be
specified in a space-separated list. Default is localhost.
!block example
TcpHost localhost secure.domain.com
!endblock
H2: TcpMap *global*
When running in INET mode, using C<tlink> or the internal HTTP server, specifies the port(s) which will be monitored by the Interchange server. Default is 7786.
To use the internal HTTP server (perhaps only for password-protected queries), a catalog may be mapped to a port. If three catalogs were running on the server C<www.akopia.com>, named C<simple>, C<sample>, and C<search>, the directive might look like this:
!block example
TcpMap 7786 - 7787 simple 7788 sample 7789 search
!endblock
Note: To map large numbers of ports, use the <<MARKER here document notation in interchange.cfg. With this in effect, the internal HTTP server would map the following addresses:
!block example
*:7786 mv_admin
*:7787 simple
*:7788 sample
*:7789 search
!endblock
Note: This does not pertain to the use of C<tlink>, which still relies on the CGI SCRIPT_PATH. To enable this, the SCRIPT_PATH aliases /simple, /sample, etc. must be set in the C<Catalog> directive. This would look like:
!block example
Catalog simple /home/interchange/catalogs/simple /cgi-bin/simple /simple
!endblock
To bind to specific IP addresses, add them in the same fashion that they would as an Apache Listen directive:
!block example
TcpMap <<EOF
127.0.0.1:7786 -
www.akopia.com:7787 -
EOF
!endblock
Note: As usual, the EOF should be at the beginning of a line with no leading or trailing whitespace.
H2: TemplateDir *global*
This can be used to supply some default pages so catalogs will not need their own copies.
Supply one or more directory names, separated by whitespace, which will be searched for pages not found in the catalog's C<PageDir> directory or the catalog-level C<TemplateDir> directory list.
!block example
TemplateDir /usr/local/interchange/default_pages
!endblock
This is undefined by default.
H2: TolerateGet *global*
Set to 'Yes' to enable parsing of both GET data and POST data when a POST has
been submitted. The default is 'No', which means that GET data is ignored
during a POST. Unfortunately this has to be a global setting because at URL
parse time, the Interchange daemon doesn't yet know which catalog it's dealing
with (due to catalog aliases, etc.).
H2: TrustProxy *global*
Allows the administrator to designate certain IP addresses or hostnames
as trusted HTTP proxies, whose claims (via the HTTP_X_FORWARDED_FOR
environment variable set by the web server) about the original requesting
host will be assumed accurate.
When using a front-end proxy for Interchange, all requests appear to come
from that proxy, for example, perhaps 127.0.0.1 if on the same machine.
This is effectively the same as running with WideOpen Yes, because all sessions
will have the same user IP address and thus can be easily hijacked. Session
hijacking can happen when someone unknowingly includes a session ID in a URL they
send to other users, and all those users then end up with the same session
and shopping cart!
TrustProxy takes a comma-separated list of one or more IP addresses and/or
hostnames, which may include wildcards (* for any number of characters,
? for a single character). For example:
E:TrustProxy 127.0.0.1, 10.0.0.*
I'm not sure why anyone would want to do this, but it could also be used
with external HTTP proxies in general (which you can only hope aren't lying),
with a simple 'TrustProxy *'.
Note that the environment variables are not modified in any way; only
Interchange's idea of the remote host is altered, as you see with
C<[data session host]>.
H2: UrlSepChar *global*
Sets the character which separates form parameters in Interchange-generated
URLs. Default is C<&>.
H2: Unix_Mode *global*
Determines whether the UNIX-domain socket will be monitored on startup.
Overridden by the command-line parameter C<-u>. Default is C<Yes>.
H2: UserTag *global*
This defines a UserTag which is global in nature, meaning not limited by the
C<Safe.pm> module, and is is available to all Interchange catalogs running on
the server. Otherwise, this is the same as a catalog UserTag.
H2: Variable *global*
Defines a global variable that will be available in all catalogs with the
notation @@VARIABLE@@. Variable identifiers must begin with a capital
letter, and can contain only word characters (B<A-Z,a-z,0-9> and underscore).
They are case-sensitive.
!block example
Variable DOCUMENT_ROOT /usr/local/etc/httpd/htdocs
!endblock
Only variables with ALL CAPS names will be parsed in catalog pages or,
when the C<ParseVariables> directive is set, in catalog (not global)
configuration directives (other than Variable itself). These are
substituted first in any Interchange page, and can contain any valid
Interchange tags including catalog variables. If a variable is called
with the notation @_VARIABLE_@, and there is no catalog Variable with
its name, the global Variable value will be inserted.
There are several standard variables which you should not set:
LI1: MV_FILE
.Name of the last file read in, as in C<[file ...]> or an externally located perl routine.
LI1: MV_NO_CRYPT
.Set this to 1 to disable encrypted passwords for the C<AdminUser>.
LI1: MV_PAGE
.Name of the last page read in, as in the page called with mv_nextpage or mv_orderpage.
LI1: CURRENCY, MV_CURRENCY
.The current locale for currency.
LI1: LANG, MV_LANG
.The current locale for language.
Some global variables can be set to affect Interchange:
LI1: MV_DOLLAR_ZERO
.This determines what Interchange does to Perl's $0 variable, which contains the operating system's name of the running process, for example in the ps(1) or top(1) commands. Valid settings are:
!block table
Setting|Result
(not set)|'interchange'
0|(do nothing)
1|'interchange --> (CATROOT)'
string|'string'
!endblock
.Note that this is set globally once only when the Interchange daemon is started, so it's pointless to change the variable after that.
H2: VarName *global*
Sets the names of variables that will be remapped to and from the URL when Interchange writes it. For instance, to display the variable C<mv_session_id> as C<session> in the user's URL:
!block example
VarName mv_session_id session
!endblock
The default can also be set in the C<etc/varnames> file after the first time Interchange is run. Setting it in C<interchange.cfg> is probably better for clarity.
There is also a catalog-specific version of this setting.
H1: catalog.cfg
Each catalog must have a {{C:catalog.cfg}} file located in its base catalog directory. It contains most of the configurable parameters for Interchange. Each is independent from catalog to catalog.
Additional configuration techniques are available in the C<catalog.cfg> file. First, set a C<Variable> and use its results in a subsequent configuration setting if C<ParseVariables> is on:
!block example
Variable SERVER_NAME www.akopia.com
Variable CGI_URL /cgi-bin/demo
ParseVariables Yes
VendURL http://__SERVER_NAME____CGI_URL__
ParseVariables No
!endblock
LI1: Define subroutine watches
.Almost any configuration variable can be set up to be tied to a subroutine if the Tie::Watch module is installed. It uses a notation like the <<HERE document, but <&HERE is the notation.
See {{CMD[jump="ictemplates.html#Programming"]Interchange Programming}} for details.
H2: Programming Watch Points in catalog.cfg
Almost any configuration variable can be set up to be tied to a subroutine if the C<Tie::Watch> module installed. It uses a notation like the <<HERE document, but <&HERE is the notation. Here is a simple case:
!block example
MailOrderTo orders@akopia.com
MailOrderTo <&EOF
sub {
my($self, $default) = @_;
if($Values->{special_handling}) {
return 'vip@akopia.com';
}
else {
return $default;
}
}
EOF
!endblock
When the order is mailed out, if the user has a variable called C<special_handling> set in their session (from UserDB, perhaps), the order will be sent to 'vip@akopia.com.' Note the single quotes to prevent problems with the @ sign. Otherwise, the order will get sent to the previously defined value of C<orders@akopia.com>.
If the configuration value being watched is a SCALAR, the subroutine gets the following call:
!block example
&{$subref}(SELF, PREVIOUS_VALUE)
!endblock
The subroutine should simply return the proper value.
SELF is a reference to the Tie::Watch object (read its documentation for what all it can do) and C<PREVIOUS_VALUE> is the previously set value for the directive. If set after the watch is set up, it will simply have the effect of destroying the watch and having unpredictable effects. (In the future, a "Store" routine may be able to be set up that can subsequently set values).
If the configuration value being watched is an C<ARRAY>, the subroutine gets the following call:
!block example
&{$subref}(SELF, INDEX, PREVIOUS_VALUE)
!endblock
C<INDEX> is the index of the array element being accessed. Setting up watch points on array values is not recommended. Most Interchange subroutines call arrays in their list context, and no access method is provided for that.
If the configuration value being watched is a C<HASH>, the subroutine gets the following call:
!block example
&{$subref}(SELF, KEY, PREVIOUS_VALUE)
!endblock
C<KEY> is the index into the hash, an example of C<HASH> type Interchange configuration values. NOTE: The following is not recommended for performance reasons. The Variable is a commonly used thing and should not bear the extra overhead of tieing, but it illustrates the power of this operation:
!block example
Variable TESTIT Unwatch worked.
Variable <&EOV
sub {
my ($self, $key, $orig) = @_;
if($key eq 'TESTIT') {
# only the first time
if($Scratch->{$key}++) {
$self->Unwatch();
return $orig->{TESTIT};
}
else {
return "Tie::Watch works! -- name=$Values->{name}";
}
}
else {
return $orig->{$key};
}
}
EOV
!endblock
The first time __TESTIT__ is called for a particular user, it will return the string "Tie::Watch works! -- name=" along with their name set in the session (if that exists). Any other variables will receive the value that they were set to previously. Once the TESTIT key has been accessed for that user, the watch is dropped upon the next access.
H2: Configuration Directives in catalog.cfg
All directives except C<MailOrderTo> and C<VendURL> have default values and are optional, though most catalogs will want to configure some of them.
H2: ActionMap
Allows setting of Interchange actions, usually with a Perl subroutine. Actions are page names like:
!block example
process Perform a processing function
order Order items
scan Search based on path info
search Search based on submitted form variables
!endblock
These are the standard supplied actions for Interchange. They can be overwritten with user-defined versions if desired. For example, to ignore the C<order> action, set:
!block example
ActionMap order sub { return 1 }
!endblock
When the leading part of the incoming path is equal to C<order>, it will trigger an action. The page name will be shifted up, and the C<order> stripped from the page name. So this custom C<order> action would essentially perform a no-op, and a URL like:
!block example
<A HREF="[area order/nextpage]"> Go to the next page </A>
!endblock
would be the equivalent of "[area nextpage]." If the action does not return a true (non-zero, non-blank) status, no page will be displayed by Interchange, not even the special C<missing> page. A response may also be generated via Perl or MVASP.
The standard C<process> action has a number of associated C<FormAction> settings. Besides using Perl, Interchange tags may be used in an action, though they are not nearly as efficient.
H2: AlwaysSecure
Determines whether checkout page operations should always be secure. Set it to the pages that should always be secure, separated by spaces and/or tabs.
!block example
AlwaysSecure ord/checkout
!endblock
H2: AsciiTrack
A file name to log formatted orders in. Unless preceded by a leading '/', will be placed relative to the catalog directory. Disabled by default.
!block example
AsciiTrack etc/tracking.asc
!endblock
If a C<Route> is set up to C<supplant>, this is ignored.
H2: AutoEnd
Sets an action that is automatically performed at the end of every
access. It is performed after any page parsing occurs, just before
the transaction ends. It takes the same kinds of parameters as
C<Autoload>.
H2: Autoload
Sets an action that is automatically performed for every access. It is
performed before any page parsing occurs, and before the action or page
is even determined. It can be set to a string containing ITL tags or to
the name of a catalog (Sub) or global subroutine. The return value from
the code run is discarded.
For example, to automatically run the Sub or GlobalSub named 'testsub':
E: Autoload testsub
To remap any C<mv_nextpage> accesses to the C<private> subdirectory of
pages, set:
!block example
Autoload [perl] $CGI->{mv_nextpage} =~ s:^private/:public/:; [/perl]
!endblock
You can temporarily change any of the catalog configuration settings,
for example, to use a different flypage depending on the user's browser type:
!block example
Autoload <<EOA
[perl]
if ($Session->{browser} =~ /msie/i) {
$Config->{Special}->{flypage} = 'ie_flypage';
}
[/perl]
EOA
!endblock
Please note that C<SpecialPage> is the corresponding directive in
the catalog configuration, not C<Special>. This is an exceptional case.
Usually the hash key has the same name as the catalog configuration
directive.
H2: AutoModifier
Sets an attribute in a shopping cart entry to the field of the same name in the C<ProductsFile> pertaining to this item. This is useful when doing shipping calculations or other embedded Perl that is based on item attributes. To set whether an item is defined as "heavy" and requires truck shipment, set:
!block example
AutoModifier heavy
!endblock
When an item is added to the shopping cart using Interchange's routines, the
C<heavy> attribute will be set to the value of the C<heavy> field in the products database. In the default demo that would be C<products>. Any changes to C<ProductFiles> would affect that, of course.
Some values are used by Interchange and are not legal:
!block example
mv_mi
mv_si
mv_ib
group
code
quantity
item
!endblock
H2: AutoVariable
Specifies directives which should be translated to Variable settings.
For scalars, the directive name becomes the Variable name and yields
its value, i.e. C<DescriptionField> becomes
C<__>C<DescriptionField__>, which would by default be description.
Array variables have a C<_N> added, where C<_N> is the ordinal index,
i.e. ProductFiles becomes C<__>C<ProductFiles_0__>,
C<__>C<ProductFiles_1__>, etc. Hash variables have a C<_KEY> added, i.e.
C<SpecialPage> becomes C<__>C<SpecialPage_missing__>,
C<__>C<SpecialPage_violation__>, etc. Doesn't handle hash keys that have
non-word characters or whitespace. Only single-level arrays and hashes
are translated properly.
H2: CommonAdjust
Settings for Interchange pricing. See C<Chained pricing>.
!block example
CommonAdjust pricing:q2,q5,q10,q25, ;products:price, ==size:pricing
!endblock
H2: ConfigDir
The default directory where directive values will be read from when using the
<file notation. Default is C<config>. The name is relative to the catalog
directory unless preceded by a /.
!block example
ConfigDir variables
!endblock
This can be changed several times in the C<catalog.cfg> file to pick up values
from more than one directory. Another possibility is to use a C<Variable>
setting to use different templates based on a setting:
!block example
Variable TEMPLATE blue
ParseVariables Yes
ConfigDir templates/__TEMPLATE__
ParseVariables No
Variable MENUBAR <menubar
Variable LEFTSIDE <leftside
Variable BOTTOM <bottom
ConfigDir config
!endblock
This will pick the C<templates/blue> template. If TEMPLATE is set to
C<red>, it would read the variables from C<templates/red>.
H2: CookieDomain
Allows a domain to be set so that multiple servers can handle traffic. For example, to use server addresses of C<secure.yourdomain.com> and C<www.yourdomain.com>, set it to:
!block example
CookieDomain .yourdomain.com
!endblock
More than one domain can be set. It must have at least two periods or browsers will ignore it.
H2: CookieLogin
Allows users to save their username/password (for Vend::UserDB) in a cookie. Expiration is set by SaveExpire and is renewed each time they log in. To cause the cookie to be generated originally, the CGI variable C<mv_cookie_password> or C<mv_cookie_username> must be set. The former causes both username and password to be saved; the latter just the username.
!block example
CookieLogin Yes
!endblock
Default is C<No>.
H2: Cookies
Determines whether Interchange will send (and read back) a cookie to get the session ID for links that go outside the catalog. Allows arbitrary HREF links to be placed in Interchange pages, while still saving the contents of the session. The default is Yes.
!block example
Cookies Yes
!endblock
If the Cookies directive is enabled, and C<mv_save_session> is set upon submission of a user form (or in the CGI variables through a Perl C<GlobalSub>), the cookie will be persistent for the period defined by C<SaveExpire>.
Note: This should almost always be "Yes."
Caching, timed builds, and static page building will never be in effect unless
this directive is enabled.
H2: CreditCardAuto
If set to Yes, enables the automatic encryption and saving of credit card information. In order for this to work properly, the C<EncryptProgram> directive must be set to properly encode the field. The best way to set C<EncryptProgram> is with PGP in the ASCII armor mode. This option uses the following standard fields on Interchange order processing forms:
LI1: C<mv_credit_card_number>
.The actual credit card number, which will be wiped from memory after checking to see if it is a valid Amex, Visa, MC, or Discover card number. This variable will never be carried forward in the user session.
LI1: C<mv_credit_card_exp_all>
.The expiration date, as a text field in the form MM/YY (will take a four-digit year as well). If it is not present, the fields C<mv_credit_card_exp_month> and C<mv_credit_card_exp_year> are looked at. It is set by Interchange when the card validation returns, if not previously set.
LI1: C<mv_credit_card_exp_month>
.The expiration date month, used if the C<mv_credit_card_exp_all> field is not present. It is set by Interchange when the card validation returns, if not previously set.
LI1: C<mv_credit_card_exp_year>
.The expiration date year, used if the C<mv_credit_card_exp_all> field is not present. It is set by Interchange when the card validation returns, if not previously set.
LI1: C<mv_credit_card_error>
.Set by Interchange to indicate the error if the card does not validate properly. The error message is not too enlightening if validation is the problem.
LI1: C<mv_credit_card_force>
.Set this value to 1 to force Interchange to encrypt the card despite its idea of validity. Will still set the flag for validity to 0 if the number/date does not validate. Still won't accept badly formatted expiration dates.
LI1: C<mv_credit_card_separate>
.Set this value to 1 to cause Interchange encrypt only the card number and not accompany it with the expiration date and card type.
LI1: C<mv_credit_card_info>
.Set by Interchange to the encrypted card information if the card validates properly. If PGP is used in ASCII armor mode, this field can be placed on the order report and embedded in the order email, replete with markers. This allows a secure order to be read for content, without exposing the credit card number to risk.
LI1: C<mv_credit_card_valid>
.Set by Interchange to true, or 1, if the the card validates properly. Set to 0 otherwise.
GnuPG is recommended as the encryption program. Interchange will also work with PGP.
!block example
CreditCardAuto Yes
!endblock
H2: Cron *5.0 and up*
Configuration for jobs run with the C<--cron> commandline option.
LI1: base_directory, use_global
Directory to search for cron jobs. The default is C<etc/cron> in
the catalog directory. If C<use_global> is set, the same directory
is searched in the global configuration directory.
LI1: initialize, autoload
The macros C<initialize> and C<autoload> are executed once resp. before
each job.
LI1: email, log, add_session
The output of a single run of cron jobs is written to a log file and
send by email if the corresponding configuration values C<email> and
C<log> are set. An email address passed by the commandline option
C<--email> has higher preference than the email address in C<email>.
If the run produces no output, neither the email will be send nor
the log file entry will be written.
C<add_session> adds the current session to the output.
LI1: from, subject, reply_to, extra_headers
Additional configuration values for the generation of the email.
H2: CustomShipping
If not blank, causes an error log entry if the shipping file entry is not found. Not otherwise used for shipping. See C<SHIPPING> for how to go about doing that.
!block example
CustomShipping Yes
!endblock
H2: Database
Definition of an arbitrary database, in the form "Database database file type," where "file" is the name of an ASCII file in the same format as the products database. The file is relative to VendRoot. Records can be accessed with the C<[data database field key]> tag. Database names are restricted to the alphanumeric characters (including the underscore), and it is recommended that they be either all lower or all upper case. See C<DATABASES>.
!block example
Database reviews reviews.txt CSV
!endblock
H2: DatabaseDefault
Defines default parameters for a database. This can be used to set a default
WRITE_CONTROL setting, set a default USER or PASSWORD, etc. It accepts any
scalar setting, which means all B<except>:
ALTERNATE_*
BINARY
COLUMN_DEF
DEFAULT
FIELD_ALIAS
FILTER_*
NAME
NUMERIC
POSTCREATE
WRITE_CATALOG
This default setting is made when the table is initially defined, i.e. explicit
settings for the database itself override the defaults set.
!block example
DatabaseDefault WRITE_CONTROL 1
DatabaseDefault WRITE_TAGGED 1
!endblock
This setting must be made *before* the database is defined. To reset its
value to empty, use the C<Replace> directive.
!block example
Replace DatabaseDefault
!endblock
H2: DefaultShipping
This sets the default shipping mode by initializing the variable C<mv_ship_mode>. If not set in C<catalog.cfg>, it is default.
!block example
DefaultShipping UPS
!endblock
Somewhat deprecated, the same thing can be achieved with:
!block example
ValuesDefault mv_shipmode UPS
!endblock
H2: DescriptionField
The field that will be accessed with the C<[item-description]> element.
!block example
DescriptionField description
!endblock
Default is C<description>. It is not a fatal error if this field does not
exist. This is especially important for on-the-fly items. If there is an
attribute set to the same name as C<DescriptionField>, this will be used for
display.
H2: DirConfig
C<DirConfig> allows you to batch-set a bunch of variables from files. The syntax:
DirConfig directive-name directory-glob
C<directive-name> is usually C<Variable>, but could be any hash-based
directive. (No other standard directives currently make sense to set this
way.)
C<directory-glob> is a filespec that could encompass multiple
directories. Files are ignored.
The directories are read for file *names* that contain only word characters,
i.e. something that would be a valid Variable. (This alone might make
it not suitable for other uses, but picking up the junk from the
in-directory-backup-file people would be intolerable.)
Then the contents of the file is used to set the variable of the file name.
The source file name is kept in $Vend::Cfg->{DirConfig}{Variable}{VARNAME},
for use if dynamic_variables Pragma is set.
Pragma C<dynamic_variables> enables dynamic updating of variables from files.
Pragma C<dynamic_variables_files_only> restricts dynamic variables to files
only -- otherwise variables are dynamically read from the VarDatabase
definition as well.
With dynamic variables, all @_VARIABLE_@ and __VARIABLE__ settings are checked
first to see if the source file is defined. If there is a key
present, even if its contents are blank, it is returned. Example -- in
the case of this catalog.cfg entry:
!block example
DirConfig Variable templates/foundation/regions
!endblock
If the file NOLEFT_TOP is present at catalog config time, __NOLEFT_TOP__ will
equal C<[include templates/foundation/regions/NOLEFT_TOP]>.
H2: DirectoryIndex
If C<DirectoryIndex> is set, and a page would normally be defined as
missing, it's value is appended (with a separating / if appropriate) and
the resulting page is looked for. To get the behavior normally
associated with an HTTP server, where "index.html" is looked for in a
directory, do:
!block example
DirectoryIndex index.html
!endblock
Default is blank, disabling the behavior.
.NOTE: Unlike Apache, only one value is accepted.
H2: DisplayErrors
If the administrator has enabled DisplayErrors globally, setting this to "Yes" will display the error returned from Interchange in case something is wrong with embedded Perl programs, tags, or Interchange itself. Usually, this will be used during development or debugging. Default is No.
!block example
DisplayErrors Yes
!endblock
H2: DynamicData
When set to one or more Interchange database identifiers, any pages using data
items from the specified database(s) will not be cached or built statically. This allows dynamic updating of certain arbitrary databases (even the products database) while still allowing static/cached page performance gains on pages not using those data items.
!block example
DynamicData inventory
!endblock
Overridden by C<[tag flag build][/tag]>, depending on context.
H2: EncryptProgram
Contains a program command line specification that indicates how an external encryption program will work. Two placeholders, C<%p> and C<%f>, are defined, which are replaced at encryption time with the password and temporary file name respectively. See C<Order Security>. This is separate from the PGP directive, which enables PGP encryption of the entire order.
If PGP is the encryption program (Interchange determines this by searching for the string C<pgp> in the command string), no password field or file field need be used. The field C<mv_credit_card_number> will never be written to disk in this case.
!block example
EncryptProgram /usr/local/bin/pgp -feat sales@company.com
!endblock
If the order C<Route> method of sending orders is used (default in the demo), this sets the default value of the C<encrypt_program> attribute.
H2: ErrorFile
This is where Interchange will write its runtime errors for THIS CATALOG ONLY. It can be shared with other catalogs or the main Interchange error log, but if it is root-based, permission to write the file is required.
!block example
ErrorFile /home/interchange/error.log
!endblock
H2: ExtraSecure
Disallows access to pages which are marked with C<AlwaysSecure> unless the browser is in HTTPS mode. A Yes/No directive, the default is 'No.'
!block example
ExtraSecure Yes
!endblock
H2: Filter
Assigns one or more filters (comma separated) to be automatically applied to a variable.
As an example, multiple form variable submissions on the same page come back null-separated, like 'C<value1\0value2\0value3>'. To automatically change those nulls to spaces, you could use this directive:
!block example
Filter mail_list null_to_space
!endblock
Of course you could just as easily use the
E<lbracket>{{CMD[jump="ictags.html#filter"]filter}}]
tag on the page if the filter is only going to be used in a few places.
See the E<lbracket>{{CMD[jump="ictags.html#filter"]filter}}]
tag documentation (wiki FilterTag) for more information and a list of filters.
H2: FormAction
Allows set up of a form action (like the standard ones C<return, submit, refresh,> etc.). It requires a Perl subroutine as a target:
!block example
FormAction foo <<EOR
sub {
$CGI->{mv_nextpage} = 'bar';
}
EOR
!endblock
If it returns a true (non-zero, non-empty) value, Interchange will display the page defined in $CGI->{mv_nextpage}. Otherwise, Interchange will not display any page. The default Interchange actions can be overridden if desired. There is also a global version of this directive, which is overridden if a catalog-specific action exists.
H2: FormIgnore
Set to the name(s) of variables that should not be carried in the user session values. Must match exactly and are case sensitive.
!block example
FormIgnore mv_searchtype
!endblock
H2: FractionalItems
Whether the quantity field for items in the shopping cart should be allowed to be fractional, i.e., 2.5 or 1.25. Default is No.
!block example
FractionalItems Yes
!endblock
H2: Glimpse
The pathname for the C<glimpse> command, used if C<glimpse> searches are to be enabled. To use C<glimpseserver>, the C<-C>, C<-J>, and C<-K> tags must be used.
!block example
Glimpse /usr/local/bin/glimpse -C -J srch_engine -K2345
!endblock
H2: History
How many of the most recent user clicks should be stored in the session history. Default is 0.
H2: HTMLsuffix
The file extension that will be seen as a page in the C<pages> directory. Default is C<.html>.
!block example
HTMLsuffix .htm
!endblock
H2: ImageAlias
Aliases for images, ala Apache/NCSA, ScriptAlias, and Alias directives. Relocates images based in a particular directory to another for Interchange use; operates after C<ImageDir>. Useful for editing Interchange pages with an HTML editor. Default is blank.
!block example
ImageAlias /images/ /thiscatalog/images/
!endblock
H2: ImageDir
The directory where all relative IMG and INPUT source file specifications are based. IT MUST HAVE A TRAILING / TO WORK. If the images are to be in the C<DocumentRoot> (of the HTTP server or virtual server) subdirectory images, for example, use the C<ImageDir> specification '/images/'. This would change SRC="order.gif" to SRC="/images/order.gif" in IMG and INPUT tags. It has no effect on other SRC tags.
!block example
ImageDir /images/
!endblock
Can be set in the Locale settings to allow different image sets for different locales (MV3.07 and up).
H2: ImageDirInternal
A value for C<ImageDir> only when the internal HTTP server is in use. It must have a trailing / to work, and should always begin with a fully-qualified path starting with C<http://>.
!block example
ImageDirInternal http://www.server.name/images/
!endblock
H2: ImageDirSecure
A value for C<ImageDir> only when the pages are being served via HTTPS. It must have a trailing / to work, and should always begin with a fully-qualified path starting with C<http://>.
!block example
ImageDirSecure /secure/images/
!endblock
This is useful if using separate HTTPS and HTTP servers, and cannot make the image directory path heads match.
H2: Locale
Sets the special locale array. Tries to use POSIX C<setlocale> based on the value of itself, then tries to accept a custom setting with the proper definitions of C<mon_decimal_point>, C<thousands_sep>, and C<frac_digits>, which are the the only international settings required. Default, if not set, is to use US-English settings.
Example of the custom setting:
!block example
Locale custom mon_decimal_point , mon_thousands_sep . frac_digits 0
!endblock
Example of POSIX setlocale for France, if properly aliased:
!block example
Locale fr
!endblock
See C<setlocale(3)> for more information. If embedded Perl code is used to sort search returns, the C<setlocale()> will carry through to string collation.
See Internationalization.
H2: LocaleDatabase
Set to the Interchange database identifier of a table that contains C<Locale> settings. These settings add on to and overwrite any that are set in the catalog configuration files, including any include files.
!block example
Database locale locale.asc TAB
LocaleDatabase locale
!endblock
H2: MailOrderTo
Specifies the e-mail address to mail completed orders to.
!block example
MailOrderTo orders@xyzcorp.com
!endblock
If 'none' is specified, no e-mailed order will be sent.
H2: NoCache
The names of Interchange pages that are not to be built statically if STATIC PAGE BUILDING is in use. If the name is a directory, no pages in that directory (or any below it) will be cached or built statically.
!block example
NoCache ord
NoCache special
!endblock
H2: NoImport
When set to one or more Interchange database identifiers, those database(s) will never be subject to import. Normally, Interchange checks to see if each database needs to be created and populated (from the source text file) when the Interchange daemon is started or restarted, or a catalog is reconfigured.
This is useful for SQL databases used by other applications besides Interchange, or large databases you load and back up outside of Interchange. With this option you can omit the source text file for SQL databases entirely.
!block example
NoImport inventory
!endblock
H2: NoImportExternal
When set to true, this directive prevents database imports for all "external" databases:
E: NoImportExternal Yes
External database types are DBI (all popular SQL databases) and LDAP. Internal database types are the DBM variants (GDBM, DB_File, SDBM) and in-memory databases.
The default setting is false (databases may be imported).
H2: NonTaxableField
The name of the field in the products database that is set (to 1 or Yes) if an item is not to be taxed. Interchange will log an error and tax it anyway if the field doesn't exist in the database. Blank by default, disabling the feature.
!block example
NonTaxableField wholesale
!endblock
H2: NoSearch
Here you can provide one or more filename fragments that will be matched against the file name used in any attempted search (the mv_search_file or 'fi' attribute). You may separate multiple match strings with whitespace, and may include shell-style wildcards.
The default setting is 'userdb', which means that by default you cannot use Interchange-style searches on the userdb table. (Pure SQL searches still work with it, however.)
For example, consider this setting:
!block example
NoSearch userdb .* *.secret
!endblock
In this case any search file with 'userdb' in its name, or beginning with a dot, or ending in '.secret', will not be searchable.
H2: OfflineDir
The location of the offline database files for use with the Interchange offline database build command. Set to "offline" as the default, and is relative to VendRoot if there is no leading slash.
!block example
OfflineDir /usr/data/interchange/offline
!endblock
H2: OnFly
Enables on-the-fly item additions to the shopping cart. If set to the name of a valid UserTag, that tag definition will be used to parse and format the item with the following call:
!block example
$item = Vend::Parse::do_tag($Vend::Cfg->{OnFly},
$code,
$quantity,
$fly[$j],
);
!endblock
C<$fly[$j]> is the value of C<mv_order_fly> for that item.
A default C<onfly> tag is provided by Interchange.
For more information,
see the section that describes
{{CMD[jump="ic_ecommerce.html#How to set up an on-the-fly item"]how to set up an on-the-fly item}}.
H2: OrderCounter
The name of the file (relative to catalog root if no leading /) that maintains the order number counter. If not set, the order will be assigned a string based on the time of the order and the user's session number.
!block example
OrderCounter etc/order.number
!endblock
Bear in mind that Interchange provides the order number as a convenience for display, and that no internal functions depend on it. Custom order number routines may be defined and used without fear of consequences.
If a C<Route> is set up to C<supplant> and the C<counter> attribute is set there, this is ignored.
H2: OrderLineLimit
The number of items that the user is allowed to place in the shopping cart. Some poorly-mannered robots may "attack" a site by following all links one after another. Some even ignore any C<robots.txt> file that may have been created. If one of these bad robots orders several dozen or more items, the time required to save and restore the shopping cart from the user session may become excessive.
If the limit is exceeded, the command defined in the Global directive C<LockoutCommand> will be executed and the shopping cart will be emptied. The default is 0, disabling the check. Set it to a number greater than the number of line items a user is ever expected to order.
!block example
OrderLineLimit 50
!endblock
H2: OrderProfile
Allows an unlimited number of profiles to be set up, specifying complex checks to be performed at each of the steps in the checkout process. The files specified can be located anywhere. If relative paths are used, they are relative to the catalog root directory.
!block example
OrderProfile etc/profiles.order etc/profiles.login
!endblock
The actions defined here are also used for C<mv_click> actions if there is no action defined in C<scratch> space. They are accessed by setting the C<mv_order_profile> variable to the name of the order profile. Multiple profiles can reside in the same file, if separated by C<__END__> tokens, which must be on a line by themselves.
The profile is named by placing a name following a C<__NAME__> pragma:
!block example
__NAME__ billing
!endblock
The C<__NAME__> must begin the line, and be followed by whitespace and the name. The search profile can then be accessed by <mv_order_profile="billing">. See Advanced Multi-level Order Pages.
H2: OrderReport
The location of the simple order report file. Defaults to etc/report.
!block example
OrderReport /data/order-form
!endblock
H2: PageDir
Location of catalog pages. Defaults to the pages subdirectory in the VendRoot directory.
!block example
PageDir /data/catalog/pages
!endblock
Can be set in the C<Locale> settings to allow different page sets for different locales.
H2: PageSelectField
Sets a products database column which can be used to select the on-the-fly template page. This allows multiple on-the-fly pages to be defined. If the field is empty (no spaces), the default C<flypage> will be used.
!block example
PageSelectField display_page
!endblock
H2: ParseVariables
Determines whether global and catalog variables will be parsed in catalog configuration directives (not including the Variable directive itself, which never parses its settings). Applies only to variables with names in ALL CAPS. Default setting is No. The foundation catalog.cfg turns ParseVariables on and usually expects it to be on.
!block example
Variable STORE_ID topshop
ParseVariables Yes
StaticDir /home/__STORE_ID__/www/cat
ParseVariables No
!endblock
H2: Password
The encrypted or unencrypted password (depending on Variable MV_NO_CRYPT) that will cause internal authorization checks for RemoteUser to allow access.
Below is the encrypted setting for a C<blank> password.
!block example
Password bAWoVkuzphOX.
!endblock
H2: PGP
If credit card information is to be accepted, and the e-mailed order will go over an insecure network to reach its destination, PGP security should be used. The key ring to be used must be for the user that is running the Interchange server, or defined by the environment variable C<PGPPATH>, and the key user specified must have a key on the public key ring of that user.
!block example
PGP /usr/local/bin/pgp -feat orders@company.com
!endblock
If this directive is non-null, the PGP command string as specified will be used to encrypt the entire order in addition to any encryption done as a result if C<CreditCardAuto>. If, for some reason, an error comes from PGP, the customer will be given the special page C<failed>.
If a C<Route> is set up to C<supplant>, this is ignored.
H2: Pragma
Sets the default value of an Interchange pragma. The directive is set like this:
!block example
Pragma my_pragma_name
!endblock
To enable a pragma for only a particular page, set it anywhere in the page:
!block example
[pragma my_pragma_name]
!endblock
To disable a pragma for a particular page, set it anywhere in the page:
!block example
[pragma my_pragma_name 0]
!endblock
Descriptions of each pragma follow.
LI1: dynamic_variables
LI1: dynamic_variables_file_only
LI1: init_page
Defines a {{CMD[jump="icconfig.html#Sub"]Sub}} or
{{CMD[jump="icconfig.html#GlobalSub *global*"]GlobalSub}} which will run
before page Variable processing. A *reference* to the contents of the
page is passed to the routine.
For instance, if a page was found that did not have a @_VARIABLE_@ in
it, you could wrap it with a template:
!block example
Pragma init_page=wrap_page
Sub <<EOS
sub wrap_page {
my $pref = shift;
return if $$pref =~ m{\@_[A-Z]\w+_\@};
$$pref =~ m{<!--+ title:\s*(.*?)\s+-->}
and $Scratch->{page_title} = $1;
$$pref = <<EOF;
\@_MYTEMPLATE_TOP_\@
<!--BEGIN CONTENT -->
$$pref
<!-- END CONTENT -->
\@_MYTEMPLATE_BOTTOM_\@
EOF
return;
}
EOS
!endblock
LI1: post_page
Defines a {{CMD[jump="icconfig.html#Sub"]Sub}} or
{{CMD[jump="icconfig.html#GlobalSub *global*"]GlobalSub}} which will run
after page Variable processing but before tag interpolation. A
*reference* to the contents of the page is passed to the routine.
Example -- you want your users to be able to edit pages and just put
in <A href="someotherpage.html">. You can use post_page to handle
this. To do so, put in catalog.cfg:
!block example
Pragma post_page=relative_urls
### Take hrefs like <A HREF="about.html"> and make relative to current
### directory
Sub <<EOR
sub relative_urls {
my $page = shift;
my @dirs = split "/", $Tag->var('MV_PAGE', 1);
pop @dirs;
my $basedir = join "/", @dirs;
$basedir ||= '';
$basedir .= '/' if $basedir;
my $sub = sub {
my ($entire, $pre, $url) = @_;
return $entire if $url =~ /^\w+:/;
my($page, $form) = split /\?/, $url, 2;
my $u = $Tag->area({
href => "$basedir$page",
form => $form,
});
return qq{$pre"$u"};
};
$$page =~ s{
(
(
<a \s+ (?:[^>]+?\s+)?
href \s*=\s*
)
(["']) ([^\s"'>]+) \3
)}
{
$sub->($1,$2,$4)
}gsiex;
return;
}
EOR
!endblock
LI1: pre_page
Defines a {{CMD[jump="icconfig.html#Sub"]Sub}}
or {{CMD[jump="icconfig.html#GlobalSub *global*"]GlobalSub}} which will
run after page Variable processing but before tag interpolation. A
*reference* to the contents of the page is passed to the routine.
LI1: no_image_rewrite
Prevents image locations in pages from being altered by Interchange. Added in Interchange 4.7.0.
Interchange normally rewrites image locations to point to ImageDir. This applies to image locations mentioned in <img src="...">, <input src="...">, <body background="...">, <table background="...">, and <tr/th/td background="...">.
When this pragma is {{B:not}} set, the following tag:
!block example
<img src="fancy.gif">
!endblock
Would, assuming an ImageDir set to /foundation/images, be transformed into:
!block example
<img src="/foundation/images/fancy.gif">
!endblock
When pragma no_image_rewrite {{B:is}} set, the <img> tag would remain unchanged.
LI1: safe_data
By default Interchange does not allow data returned from databases to be reparsed for Interchange tags. Setting the safe_data pragma eliminates this restriction.
If for some reason you want to have tags in your database, for example, to use [page ...] for catalog-internal hyperlinks in your product descriptions, you need to enable safe_data. Some things to consider:
^It may be better to use the safe_data attribute available to certain tags instead of the pragma, or perhaps to use [pragma] for a whole page or [tag pragma] ... [/tag] for a small block, instead of a catalog-wide Pragma directive.
+In any case it is strongly recommended that you surround the area with [restrict] ... [/restrict] tags to allow only the specific (hopefully relatively safe) set of tags you expect to appear, such as [page] or [area]. Expect security compromises if you allow [calc] or [perl], or other extremely powerful tags.
+Be certain that you know everywhere the data in your database will be used. Will it always be possible to reparse for tags? What about when it's used to create an emailed plain-text receipt -- will a literal '[page ...]' tag show up in the product description on the receipt? Would the desired output of '<a href="...">' be any better in a plaintext situation? What if you access your database from applications other than Interchange? You'll then have to decide what to do with such tags; perhaps you can simply strip them, but will the missing tag output cause you any trouble?
In short, safe_data is disabled by default for a reason, and you should be very careful if you decide to enable it.
(Watch out for parse order with [tag pragma] or [restrict] when used with lists that retrieve data from the database, as in [PREFIX-*] and the flypage. Loops parse before regular tags like [tag] and [restrict], and thus aren't affected by it.)
LI1: strip_white
Set this to strip whitespace from the tops of HTML pages output by Interchange. Such whitespace usually comes from Interchange tags at the top of the page. The pragma's purpose is mostly to make 'view source' in the browser a slightly more tolerable experience.
Default is off; whitespace is unchanged.
H2: PriceCommas
If no commas are desired in price numbers (for the C<[item-price]> tag), set this to C<No>. The default is to use commas (or whatever is the thousands separator for a locale).
!block example
PriceCommas no
!endblock
This is overridden if a Locale C<price_picture> is set.
H2: PriceDivide
The number the price should be divided by to get the price in units (dollars or such). The default is one. If penny pricing is used, set it to 100.
!block example
PriceDivide 100
!endblock
Can be set in the C<Locale> settings to allow a price adjustment factor for different currencies.
H2: PriceField
The field in the product database that will be accessed with the C<[item-price]> element. Default is "price."
!block example
PriceField ProductPrice
!endblock
Can be set in the C<Locale> settings to allow different price fields for different currencies.
H2: ProductDir
Location of the database files. Defaults to the products subdirectory of the VendRoot directory. May not be set to an absolute directory unless C<NoAbsolute> is defined as No.
!block example
ProductDir /data/catalog/for-sale
!endblock
Most people never set this directive and use the default of C<products>.
H2: ProductFiles
Database tables that should be seen as the "products" database.
!block example
ProductFiles vendor_a vendor_b
!endblock
The key thing about this is that each will be searched in sequence for a product code to order or an C<[item-field ....]> or C<[loop-field ...]> to insert. The main difference between C<[item-field ....]> and C<[item-data table ...]> is this fall-through behavior.
Default is C<products>.
H2: ReadPermission and WritePermission
By default, only the user account that Interchange runs under (as set by the SETUID permission on vlink) can read and write files created by Interchange. C<WritePermission> and C<ReadPermission> can be set to C<user>, C<group>, or 'world'.
!block example
ReadPermission group
WritePermission group
!endblock
H2: RemoteUser
The value of the HTTP environment variable C<REMOTE_USER> that will enable catalog reconfiguration. HTTP basic authentication must be enabled for this to work. Default is blank, disabling this check.
!block example
RemoteUser interchange
!endblock
H2: Replace
Causes a directive to be emptied and re-set (to its default if no value is specified). Useful for directives that add to the value by default.
!block example
Replace NoCache ord special multi reconfig query
!endblock
Capitalization must be exact on each directive.
H2: Require
Forces a Perl module, global C<UserTag>, or C<GlobalSub> to be present before the catalog will configure. This is useful when transporting catalogs to make sure they will have all needed facilities.
!block example
Require usertag email
Require globalsub form_mail
Require module Business::UPS
!endblock
H2: RobotLimit
The RobotLimit directive defines the number of consecutive pages a user session may access without a 30 second pause. If the limit is exceeded, the command defined in the Global directive C<LockoutCommand> will be executed and catalog URLs will be rewritten with host 127.0.0.1, sending the robot back to itself. The default is 0, disabling the check.
!block example
RobotLimit 200
!endblock
H2: Route
Sets up order routes. See C<Custom Order Routing>. There are examples in the demo C<simple>.
H2: SalesTax
If non-blank, enables automatic addition of sales tax based on the order form.
The value is one of three types of values:
=over 4
=item multi
The special value "multi" enables table-based lookup of taxing rates based
on the value of user form values, by default C<country> and C<state>.
=item [itl-tags]
If the value has a left square bracket, it is interpolated for ITL tags
and the result used as the amount of the salestax.
=item var1, var2
A comma-separated list of the field names (as placed in the checkout page, for
example ord/checkout.html) in priority order. These are be used to look up
sales tax percentage in the C<salestax.asc> ASCII table. (This table is not
supplied with Interchange.)
!block example
SalesTax zip state
!endblock
=back
H2: SalesTaxFunction
A Perl subroutine that will return a hash reference with the sales tax settings. This can be used to query a database for the tax for a particular vendor:
!block example
SalesTaxFunction <<EOR
my $vendor_id = $Session->{source};
my $tax = $TextSearch->hash( {
se => $vendor_id,
fi => 'salestax.asc',
sf => 'vendor_code',
ml => 1000,
} );
$tax = {} if ! $tax;
$tax->{DEFAULT} = 0.0;
return $tax;
EOR
!endblock
or simply produce a table:
!block example
SalesTaxFunction <<EOR
return {
DEFAULT => 0.0,
IL => 0.075,
OH => 0.065,
};
EOR
!endblock
A C<DEFAULT> value must always be returned or the function will be ignored.
H2: SaveExpire
The default amount of time that a cookie will be valid (other than the MV_SESSION_ID cookie). The ones used in Interchange by default are C<MV_USERNAME> and C<MV_PASSWORD> for the C<CookieLogin> feature. Specified the same as C<SessionExpire>, with an integer number followed by one of C<minutes>, C<hours>, C<days>, or C<weeks>.
!block example
SaveExpire 52 weeks
!endblock
Default is C<30 days>.
H2: ScratchDefault
The default scratch variable settings that the user will start with when their session is initialized.
To disable placing URL rewrite strings after the user has given a cookie, set:
!block example
ScratchDefault mv_no_session_id 1
ScratchDefault mv_no_count 1
ScratchDefault mv_add_dot_html 1
!endblock
To set the default locale:
!block example
ScratchDefault mv_locale de_DE
!endblock
H2: ScratchDir
The directory where temporary files will be written, notably cached searches and retired session IDs. Defaults to C<tmp> in the catalog directory.
!block example
ScratchDir /tmp
!endblock
H2: SearchProfile
Allows an unlimited number of search profiles to be set up, specifying complex searches based on a single click. The directive accepts a file name based in the catalog directory if the path is relative:
!block example
SearchProfile etc/search.profiles
!endblock
As an added measure of control, the specification is evaluated with the special Interchange tag syntax to provide conditional setting of search parameters. The following file specifies a dictionary-based search in the file 'dict.product':
!block example
__NAME__ dict_search
mv_search_file=dict.product
mv_return_fields=1
[if value fast_search]
mv_dict_limit=-1
mv_last=1
[/if]
__END__
!endblock
The C<__NAME__> is the value to be specified in the C<mv_profile> variable on the search form, as in
!block example
<INPUT TYPE=hidden NAME=mv_profile VALUE="dict_search">
!endblock
or with mp=profile in the one-click search.
!block example
[page scan se=Renaissance/mp=dict_search]Renaissance Art</a>
!endblock
Multiple profiles can reside in the same file, if separated by C<__END__> tokens. C<__NAME__> tokens should be left-aligned, and C<__END__> must be on a line by itself with no leading or trailing whitespace.
H2: SecureURL
The base URL for secure forms/page transmissions. Normally it is the same as VendURL except for the C<https:> protocol definition. Default is blank, disabling secure access.
!block example
SecureURL https://machine.com/xyzcorp/cgi-bin/vlink
!endblock
H2: SendMailProgram
The location of the sendmail binary, needed for mailing orders. Must be found at startup. This often needs to be set for FreeBSD or BSDI.
!block example
SendMailProgram /usr/sbin/sendmail
!endblock
If set to C<none>, no mail can be sent by standard Interchange facilities. The default is the value in C<interchange.cfg> and varies depending on operating system.
H2: SeparateItems
Changes the default when ordering an item via Interchange to allowing multiple lines on the order form for each item. The default, C<No>, puts all orders with the same part number on the same line.
Setting C<SeparateItems> to C<Yes> allows the item attributes to be easily set for different instances of the same part number, allowing easy setting of things such as size or color.
!block example
SeparateItems Yes
!endblock
Can be overridden with the C<mv_separate_items> variables (both scratch and values).
H2: SessionDatabase
When storing sessions, specify the name of the directory or DBM file to use. The file extensions of .db or .gdbm (depending on the DBM implementation used) will be appended. If the default file-based sessions are used, it is the name of the directory.
!block example
SessionDatabase session-data
!endblock
Can be an absolute path name, if desired.
It is possible for multiple catalogs to share the same session file, as well as for multiple Interchange servers to serve the same catalogs. If serving a extremely busy store, multiple parallel Interchange servers can share the same NFS-based file system and serve users in a "ping-pong" fashion using the file-based sessions. On huge systems, the level of directory hashing may be changed. By default, only 48 * 48 hashing is done. See the source for C<SessionFile.pm>.
H2: SessionDB
The name of the Interchange database to be used for sessions if DBI is specified as the session type. This is not recommended.
H2: SessionExpire
A customer can exit the browser or leave the catalog pages at any time, and no indication is given to the web server aside from the lack of further requests that have the same session ID. Old session information needs to be periodically expired. The C<SessionExpire> specifies the minimum time to keep track of session information. Defaults to one day. Format is an integer number, followed by s(econds), m(inutes), h(ours), d(ays), or w(eeks).
!block example
SessionExpire 20 minutes
!endblock
If C<CookieLogin> is in use, this can be a small value. If the customer's browser has the Interchange session cookie stored, he/she will be automatically logged back in with the next request. Note, however, that the customer's cart and session values will be reset.
H2: SessionLockFile
The file to use for locking coordination of the sessions.
!block example
SessionLockFile session-data.lock
!endblock
This only applies when using DBM-based sessions. It is possible for multiple catalogs to share the same session file. C<SessionDatabase> needs to be set appropriately if the database is to be shared. Defaults to C<session.lock>, which is appropriate for separate session files (and therefore standalone catalogs). Can be an absolute path name, if desired.
H2: SessionType
The type of session management to be used. Use one of the following:
!block example
DB_File Berkeley DB
DBI DBI (don't use this, normally)
File File-based sessions (the default)
NFS File-based sessions, forces use of fcntl locking
GDBM GDBM
!endblock
The default is file-based sessions, which provides the best performance and reliability in most environments.
If you are planning on running Interchange servers with an NFS-mounted filesystem as the session target, you must set SessionType to "NFS". The other requisites are usually:
1. fcntl() supported in Perl
2. lock daemon running on NFS server system
3. lock daemon running on Interchange server
See also the global directive LockType.
H2: SpecialPage
Sets a special page to other than its default value. Can be set as many
times as necessary. Will have no effect if not one of the Interchange
Required Pages.
!block example
SpecialPage checkout ord/checkout
SpecialPage failed special/error_on_order
SpecialPage interact special/browser_problem
SpecialPage noproduct special/no_product_found
SpecialPage order ord/basket
SpecialPage search srch/results
!endblock
H2: SpecialPageDir
The directory where special pages are kept. Defaults to C<special_pages> in the catalog directory.
!block example
SpecialPageDir pages/special
!endblock
H2: Static
A Yes/No directive. Enables static page building and display features. Default is C<No>.
!block example
Static Yes
!endblock
H2: StaticAll
A Yes/No directive. Tells Interchange to try and build all pages in the catalog statically when called with the static page build option. This is subject to the settings of C<StaticFly>, C<StaticPath>, and C<NoCache>. Default is No. Pages that have dynamic elements will not be built statically, though that may be overridden with C<[tag flag build][/tag]> on the page in question.
!block example
StaticAll Yes
!endblock
H2: StaticDepth
The number of levels of static search building that will be done if a search results page contains a search. Default is one, though it could be very long if set higher. Set to 0 to disable re-scanning of search results pages.
!block example
StaticDepth 2
!endblock
H2: StaticDir
The absolute path of the directory which should be used as the root for static pages. The user ID executing Interchange must have write permission on the directory (and all files within) if this is to work.
!block example
StaticDir /home/you/www/catalog
!endblock
H2: StaticFly
A Yes/No directive. If set to C<Yes>, static builds will attempt to generate a page for every part number in the database using the on-the-fly page build capability. If pages are already present with those names, they will be overwritten. The default is C<No>.
!block example
StaticFly Yes
!endblock
H2: StaticPage
Tells Interchange to build the named page (or pages, whitespace separated)
when employing the static page-building capability of Interchange. Not necessary if using C<StaticAll>.
!block example
StaticPage info/about_us info/terms_and_conditions
!endblock
H2: StaticPath
The path (relative to HTTP document root) which should be used in pages built with the static page-building capability of Interchange.
!block example
StaticPath /catalog
!endblock
H2: StaticPattern
A perl regular expression which is used to qualify pages that are to be built statically. The default is blank, which means all pages qualify.
!block example
StaticPattern ^info|^help
!endblock
H2: StaticSuffix
The extension to be appended to a normal Interchange page name when building
statically. Default is C<.html>. Also affects the name of pages in the
Interchange page directory. If set C<to .htm>, the pages must be named with that
extension.
!block example
StaticSuffix .htm
!endblock
H2: Sub
Defines a catalog subroutine for use by the C<[perl][/perl]> or [mvasp] embedded perl languages. Use the "here document" capability of Interchange
configuration files to make it easy to define:
!block example
Sub <<EOF
sub sort_cart_by_quantity {
my($items) = @_;
$items = $Items if ! $items;
my $out = '<TABLE BORDER=1>';
@$items = sort { $a->{quantity} <=> $b->{quantity} } @$items;
foreach $item (@$items) {
my $code = $item->{code};
$out .= '<TR><TD>';
$out .= $code;
$out .= '</TD><TD>';
$out .= $Tag->data('products', 'name', $code);
$out .= '</TD><TD>';
$out .= $Tag->data('products', 'price', $code);
$out .= '</TD></TR>';
}
$out .= '&lt/TABLE>';
return $out;
}
EOF
!endblock
As with Perl "here documents," the EOF (or other end marker) must be the ONLY thing on the line, with no leading or trailing white space. Do not append a semicolon to the marker. The above would be called with:
!block example
[perl]
my $cart = $Carts->{main};
return sort_cart_by_quantity($cart);
[/perl]
!endblock
and will display an HTML table of the items in the current shopping cart, sorted by the quantity. Syntax errors will be reported at catalog startup time.
Catalog subroutines may not perform unsafe operations. The Safe.pm
module enforces this unless global operations are allowed for the
catalog. See C<AllowGlobal>.
H2: Suggests
Generates a warning message when a Perl module, global C<UserTag>, or
C<GlobalSub> is not present at catalog configuration time. Same as the
C<Require> directive except not fatal.
!block example
Suggest usertag table_editor
Suggest globalsub file_info
Suggest module Business::UPS
!endblock
H2: TableRestrict
Used to provide "views" in database-based searches. Does not affect the text searches. Affects the table being searched.
Takes the form of C<field=session_param>, where C<field> is a column in the table being iterated over, and C<session_param> is a C<$Session> key (i.e., [data session username]).
!block example
TableRestrict products owner=username
!endblock
The above would prevent the database search from returning any records except those where the column C<owner> contains the current value of C<[data session username]>.
Probably most usefully set by embedded Perl code in certain situations. For example:
!block example
[calc]
# Restrict edit to owned fields
$Config->{TableRestrict}{products} = 'owner=username';
return;
[/calc]
!endblock
When using SQL-based databases, in effect it turns the base search query
!block example
select * from products
!endblock
into
!block example
select * from products where owner = '[data session username]'
!endblock
Interchange databases are similarly affected, though the methodology is different. Also may be useful in "mall" situations, where user is allowed to only see products from the current store ID.
H2: TaxShipping
A comma or space-separated list of states or jurisdictions that tax shipping cost, i.e., UT. Blank by default, never taxing shipping.
!block example
TaxShipping UT,NV,94024
!endblock
H2: TemplateDir
Sets one or more directories (separated by whitespace) which will be searched (in order) for pages not found in the C<PageDir>. If a page is not found in directories specified here, the search continues with the global C<TemplateDir> setting, if defined.
!block example
TemplateDir /var/lib/interchange/foundation/bonus_pages
!endblock
This is undefined by default.
H2: TrackFile
Name of a logfile that tracks user traffic. This is used in the back office administration report on traffic by affiliate.
The default is that no such file is kept.
See {{CMD[jump="icadvanced.html#Usertracking"]Usertracking}} for more
information.
H2: UpsZoneFile
The file containing the UPS zone information, specified relative to the catalog directory unless it begins with a /. It can be in the format distributed by UPS or can be in a tab-delimited format, with the three-letter zip prefix of the customer used to determine the zone. It interpolates based on the value in C<mv_shipmode>. A user database named the same as the mv_shipmode variable must be present or the lookup will return zero.
IMPORTANT NOTE: Zone information and updated pricing from UPS must be obtained in order for this to work properly. The zone information is specific to a region!
!block example
UpsZoneFile /usr/interchange/data/ups_zone.asc
!endblock
H2: UseModifier
Determines whether any attributes, the modifiers specified in the directive, can be attached to the item. See C<Item Attributes>. The default is no modifier. Don't use a value of C<quantity> or this directive will not work properly.
!block example
UseModifier size,color
!endblock
Some values are used by Interchange and are not legal:
!block example
mv_mi
mv_si
mv_ib
group
code
quantity
item
!endblock
H2: UserDB
Sets parameters to define the behavior of Interchange's user database functions.
!block table
Parameter|Default|Explanation
acl|acl|Set field for simple access control storage
addr_field|address_book|Set field name for address book
assign_username|0|Tell interchange to automatically assign username
bill_field|accounts|Set field name for accounts
cart_field|carts|Set field name for cart storage
clear_coookie||Comma-separated list of cookies to clear on explicit logout
clear_session||Clear user session completely on logout
counter||Counter file for assign_username function
crypt|1|Encrypt (1) or not encrypt (0) passwords
database|userdb|Sets user database table
db_acl|db_acl|Set field for database access control storage
expire_field|expiration|Set field for expiration date
file_acl|file_acl|Set field for file access control storage
force_lower|0|Force possibly upper-case database fields to lower case session variable names
ignore_case|0|Ignore case in usernames/passwords
indirect_login||Log in field if different than real username
logfile|error.log|File to log authentications/errors
md5|0|Use MD5 for encryption algorithm instead of crypt
no_get|0|Don't get values from database on login
no_login|0|Log people in to accounts even if they are already logged in
outboard_key_col||Set field providing key for outboard tables
outboard||Set fields that live in another table
pass_field|password|Set field name for password
passminlen|2|Minimum length for password
pref_field|preferences|Set field name for preferences
scratch||Fields to set in user Scratch space (instead of Values)
sql_counter||SQL counter spec (sequence or AUTO_INCREMENT) for assign_username function
super_field|super|Field to determine superuser status if admin profile
time_field|time|Set field for storing last login time
unix_time|0|Set if unix (seconds since 1970) time to go in log files
userminlen|2|Minimum length for username
username_mask||Regular expression usernames must not match
!endblock
These are set in a C<catalog.cfg> file with something like:
UserDB default crypt 0
UserDB admin crypt 1
UserDB admin md5 1
where C<default> or C<admin> is the name of the profile to set. These can
be overriden if passed in the tag:
> [userdb userminlen=6 new-account=1]
H2: UserTag
Defines a catalog-based UserTag that will run under Safe.pm restrictions.
For many purposes, a global UserTag (CfgUserTagGlobal) is better.
H2: ValuesDefault
Sets the initial state of the user values, i.e., [value key] or $Values->{key}.
!block example
ValuesDefault fname New
ValuesDefault lname User
!endblock
When the user session starts, C<[value fname] [value lname]> will be "New User."
H2: Variable
Defines a catalog variable that will be available in the current catalog
with the notation C<__VARIABLE__>. Variable identifiers must begin with
a capital letter, and can contain only word characters (B<A-Z,a-z,0-9>
and underscore). They are case-sensitive.
!block example
Variable DOCUMENT_ROOT /usr/local/etc/httpd/htdocs
!endblock
Only variables with ALL CAPS names will be parsed in catalog pages or,
when the C<ParseVariables> directive is set, in catalog configuration
directives (other than in Variable directives themselves). These are
substituted second (right after global Variables) in any Interchange page,
and can contain any valid Interchange tags except global variables. If a
variable is called with the notation @_VARIABLE_@, and there is no catalog
Variable with its name, the global Variable value will be inserted.
H2: VariableDatabase
The name of a database containing a field Variable which will be used to set Interchange variable values. For example, a database defined as:
!block example
Database var var.txt TAB
VariableDatabase var
!endblock
and containing
!block example
code Variable
HELLO Hi!
!endblock
would cause C<__HELLO__> to appear as C<Hi!>.
The field name is case-sensitive, and C<variable> would not work.
The values are inserted at time of definition. Any single-level hash-oriented Interchange directive, such as C<SpecialPage>, C<ScratchDefault>, or C<ValuesDefault>, can be set in the same way. If the C<VariableDatabase> named does not exist at definition time, a database of the default type with an ASCII file source appending C<.txt> is assumed. In other words:
!block example
VariableDatabase variable
!endblock
is equivalent to
!block example
Database variable variable.txt TAB
VariableDatabase variable
!endblock
H2: VendURL
Specifies the base URL that will run vlink as a cgi-bin program.
!block example
VendURL http://machine.company.com/cgi-bin/vlink
!endblock
H2: WideOpen
Disables IP qualification of user sessions. {{B:This degrades catalog security.}} Do not use unless using encryption or a real-time payment gateway.
Line:
N:Copyright 2002-2004 Interchange Development Group. Copyright 2001-2002 Red Hat, Inc. Freely redistributable under terms of the GNU General Public License.