Configuration method

If configuration file contains method conf, this method will be executed first, before method auto, to set vital system parameters:
·Files defining character sets;  
·HTTP POST-request size limit;  
·Mail-sending server/application;  
·SQL-drivers and their parameters;  
·Table to associate filename extension with its mime-type.  

We recommend that you place this method in in configuration file.

Method is defined like the following:
@conf[filespec]

…where
filespec is full name of file containing the method.

Charset
UTF-8, used in Parser by default, is always available and thus doesn't have to be loaded. To use other charsets, specify files defining them. This should be done in the following way:
$CHARSETS[
   $.windows-1251[/full/path/to/windows-1251.cfg]
   …
]

See "Files defining character sets".

Size limit for POST data:
$LIMITS[
   $.post_max_size(10*0x400*0x400)
]

Parameters for mail-sending program (see
^mail:send[…])…

…under Windows and UNIX-SMTP-server address

$MAIL[
   $.SMTP[mail.office.design.ru]
]

…under UNIX:

in safe mode versions you can configure mail-sending program only if you compile Parser from source code, by yourself. Binary versions, which are available for download directly from
http://parser.ru/en/download/, configure mail-sending in such a way:

   /usr/sbin/sendmail -i -t -f postmaster

It is only in unsafe-mode versions that you can specify mail-sending program by yourself:
$MAIL[
   $.sendmail[/custom/mail/sending/program params]
]

…and by default Parser uses command…

   /usr/sbin/sendmail -t -i -f postmaster

…or command…

   /usr/lib/sendmail -t -i -f postmaster

…depending on system you use.

When a message is being sent, Parser will replace "
postmaster" with mail-sender's address from obligatory header field "from".

One can also provide a table of SQL-drivers:
$SQL[
$.drivers
[^table::create{protocol   driver   client
mysql   /full/disk/path/parser3mysql.dll   /full/disk/path/libmySQL.dll
odbc   /full/disk/path/parser3odbc.dll
pgsql /full/disk/path/parser3pgsql.dll   /full/disk/path/libpq.dll
sqlite /full/disk/path/parser3sqlite.dll   /full/disk/path/sqlite3.dll
oracle   /path/to/parser3oracle.dll   C:\Oracle\Ora81\BIN\oci.dll?PATH+=^;C:\Oracle\Ora81\bin
}]
]
Column client of table drivers may contain parameters passed to client's library, delimited from file name with character ?. The whole construction will look like:
name1=value1&name2=name2&…
…as well as…
name+=value
These variables will replace (=) or be appended to (+=) already existing value in program environment before the library is initialized. Such an approach is particularly useful when you add path to Oracle libraries, if this path has not been already specified in program's system environment.

Table to associate filename extension with its mime-type:

#
 file created with ^file::load[…],
#
 will specify this $response:content-type when output in $response:body
$MIME-TYPES[^
table::create{ext mime-type
zip application/zip
doc application/msword
xls application/vnd.ms-excel
pdf application/pdf
ppt application/powerpoint
rtf application/rtf
gif image/gif
jpg image/jpeg
jpeg image/jpeg
png image/png
tif image/tiff
html text/html
htm text/html
txt text/plain
mts application/metastream
mid audio/midi
midi audio/midi
mp3 audio/mpeg
ram audio/x-pn-realaudio
rpm audio/x-pn-realaudio-plugin
ra audio/x-realaudio
wav audio/x-wav
au audio/basic
mpg video/mpeg
avi video/x-msvideo
mov video/quicktime
swf application/x-shockwave-flash
}]

File name extensions in this table should be given in lowercase. Table search is case-insensitive, so, for example, file FACE.GIF will acquire mime-type image/gif.


Copyright © 1997–2010 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 22.02.2007