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;  
·file size limit   [3.4.5];  
· ñount of loops iterations and recoursion depth limit   [3.4.5];
·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".

$LIMITS[
#Size limit for POST data, default is 10Mb:
   $.post_max_size(10*0x400*0x400)
#Size limit for files to be read into memory, default is 512Mb:
   $.max_file_size(512*0x400*0x400)
#Loops iterations limit, default is 20000:
   $.max_loop(20000)
#Recoursion depth limit, default is 1000:
   $.max_recoursion(1000)
#File lock wait timeout for reading or writing, default is 9.5 seconds:
   $.lock_wait_timeout(9.5)
]

Setting
max_file_size, max_loop, max_recoursion to zero value means 'unlimited'.


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
7z   application/x-7z-compressed
au   audio/basic
avi   video/x-msvideo
css   text/css
cvs   text/csv
doc   application/msword
docx   application/vnd.openxmlformats-officedocument.wordprocessingml.document
dtd   application/xml-dtd
gif   image/gif
gz   application/x-gzip
htm   text/html
html   text/html
ico   image/x-icon
jpeg   image/jpeg
jpg   image/jpeg
js   application/javascript
json   application/json
log   text/plain
mid   audio/midi
midi   audio/midi
mov   video/quicktime
mp3   audio/mpeg
mpg   video/mpeg
mpeg   video/mpeg
mts   application/metastream
pdf   application/pdf
png   image/png
ppt   application/powerpoint
ra   audio/x-realaudio
ram   audio/x-pn-realaudio
rar   application/x-rar-compressed
rdf   application/rdf+xml
rpm   audio/x-pn-realaudio-plugin
rss   application/rss+xml
rtf   application/rtf
svg   image/svg+xml
swf   application/x-shockwave-flash
tar   application/x-tar
tgz   application/x-gzip
tif   image/tiff
txt   text/plain
wav   audio/x-wav
xls   application/vnd.ms-excel
xlsx   application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xml   text/xml
xsl   text/xml
zip   application/zip
}]

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.

If
$STRICT-VARS(true) is specified every attempt to access to uninitialized variable will cause an exception.   [3.4.2]




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