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
...
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]

If
$LOCALS(true) is specified, all the variables of the all methods of all the classes will be local.   [3.4.6]



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