ScriptBasic Configuration File
ScriptBasic uses a configuration file to define it's environment and configure extensions. The configuration file must be converted to a binary format to be used with the interpreter. ScriptBasic has a command line option to compile your text formatted version of the configuration file.
scriba -k scriba.conf.txt
This will create a scriba.conf file in it's binary format in the current directory under Windows or the /etc/scriba directory under Linux. You can dump your binary version of the configuration file to the screen with the follwing command line option.
Note: The dump option will not restore the comments of the original configuration file nor the line breaks or spaces (except those in strings).
You can tell ScriptBasic to use an alternate configuration file by using the -f option.
scriba -f custom.conf mypgm.bas
The format of the text file version of the configuration information is simple. It contains the keys and the corresponding values separated by one or more spaces and new lines. Usually a key and the assigned value are written on a line. Lines starting with the character ; are comment. The values can be integer numbers, real numbers, strings and sub-configurations. Strings can either be single line started and terminated by a single " character or multi-line strings starting and ending with three """ characters, just like in the language ScriptBasic. Sub-configurations start with the character ( and are closed with the character ). The lists between the parentheses are keys and corresponding values.
Sub-configuration levels without keys is not permitted and should be commented out or removed.
; install.conf.txt ; ScriptBasic sample configuration file ; ; Note that this configuration file format is from v1.0b19 or later and has to be compiled ; to internal binary format before starting ScriptBasic ; this is the extension of the dynamic load libraries on this system dll ".dll" ; where the modules are to be loaded from module "G:/sb21/\\modules\\" ; where to search system and module include files ; trailing / or \ is needed include "G:/sb21/\\include\\" ; this is where modules should install their documentation docu "G:/sb21/\\doc\\" ; the maximum number of includes that script basic processes ; this will stop the reading when the programmer makes error ; and includes files recursively. 1000 is the default value maxinclude 100 ; ; define preprocessors ; preproc ( ; define the debugger internal preprocessor internal ( ; dbg "G:/sb21/\\modules\\dbg.dll" ) ; extensions that external preprocessors are to be applied on extensions ( ; here the key is the file name extension and the value is the symbolic name of the external preprocessor ; for example ; lsp "lisp" ; would say that all input that has the file name extension '.lsp' should be preprocessed using the external ; preprocessor named 'lisp'. The commad line to start this preprocessor has to be defined a few lines below ; saying: ; lisp ( ; executable "command line" ; directory "directory for the temporary files after preprocessing" ; ) ; Note that this is only an example, there is no 'lisp' preprocessor for ScriptBasic or at least I do not know any. ; heb "heb" ) ; the external preprocessors external ( heb ( executable "G:/sb21/\\bin\\scriba.exe G:/sb21/\\source\\heber.bas" directory "G:/sb21/\\hebtemp\\" ) ) ) ; ; LIMIT VALUES TO STOP INIFINITE LOOP ; ; the maximal number of steps allowed for a program to run ; comment it out or set to zero to have no limit maxstep 0 ; the maximal number of steps allowed for a program to run ; inside a function. ; comment it out or set to zero to have no limit maxlocalstep 0 ; the maximal number of recursive function call deepness ; essentially this is the "stack" size maxlevel 300 ; the maximal memory in bytes that a basic program is allowed to use ; for its variables maxmem 0 ; ; ScriptBasic loads the modules before starting the code ; in the order they are specified here ; ;preload "ext_trial" ; ; This is the directory where we store the compiled code ; to automatically avoid recompilation ; ; cache "G:/sb21/\\cache\\" cgi ( ; ; These are the keys used by the CGI module ; debugfile "G:/sb21/\\cgidebug.txt" ) ; ; berkeley db config ; ;bdb ( ; directories where to store the ;dir ( ; home "G:/sb21/\\sampledb" ; the home directory of operation of the Berkerley DB ; data "db" ; database files ; log "log" ; log files ; temp "tmp" ; temporary files ; ) ; ScriptBasic extension modules can access only string configuration values ; therefore you have to specify these numbers within quotes (later versions will change it) ; limits ( ; lg_max "1024000" ; mp_mmapsize "0000" ; mp_size "000" ; tx_max "000" ; lk_max "000" ; ) ; what lock strategy to use ; it can be any of the followings ; default oldest random youngest ; lockstrategy default ; flags ( ; ; set the value to yes or no ; lock_default no ; init_lock yes ; init_log yes ; init_mpool yes ; init_txn yes ; create yes ; ) ; ) ; ; MySQL configuration ; ;mysql ( ; connections ( ; test ( ; the name of the connection ; host "127.0.0.1" ; the host for the connection ; db "test" ; database for the connection ; user "root" ; user for the connection ; password "" ; password for the connection ; port 0 ; the port to use ; socket "" ; the name of the socket or "" ; flag 0 ; the client flag ; clients 10 ; how many clients to serve before really closing the connections ; ) ; auth ( ; host "127.0.0.1" ; the host for the connection ; db "auth" ; database for the connection ; user "root" ; user for the connection ; password "" ; password for the connection ; port 0 ; the port to use ; socket "" ; the name of the socket or "" ; flag 0 ; the client flag ; clients 10 ; how many clients to serve before really closing the connections ; ) ; ) ; ) ;odbc ( ; connections ( ; test ( ; the name of the connection ; dsn "test" ; data source name ; user "" ; user for the connection, to test we use MS-Access thus there is no user or passwd ; password "" ; password for the connection ; ) ; ) ; ) ; This type of internal preprocessor was experimental and is not supported by ScriptBasic ; since build v1.0b26 ; Configure the sample preprocessor ; ; preproc$sample_uppercase "D:/MyProjects/sb/Debug/preproc.dll" ; ;break
Application Server Configuration
Note that scripts may change the working directory therefore all directories should be specified here full path. For example the directory names here do not include the drive c: or e: because I develop it on two machines and it was inconvenient to alter and recompile the config file each time I moved the source to the other machine. When I run a script that changes the drive the http daemon stops in a few seconds because the guard thread do not find the pid file and therefore tells the engine to stop.
servers ( server ( port 8080 protocol http ip "127.0.0.1" ) threads 20 listenbacklog 1 home "F:\\Program Files\\Apache Group\\Apache2\\cgi-bin\\" proxyip 1 ; set it true if you use Eszter engine behind Apache rewrite and proxy modules pid ( file "G:/sb21/\\httpdlog\\pid.txt" delay 60 ; number of seconds to sleep between the examination of the pid file if that still exists wait ( period 1 ; number of times to wait for the threads to stop before forcefully exiting length 2 ; number of seconds to wait for the threads to stop (total wait= period*length) ) ) vdirs ( ; dir "/user/:G:/sb21/\\source\\examples\\user\\" dir "/cgi-bin/:F:\\Program Files\\Apache Group\\Apache2\\cgi-bin\\" ) ; client ( ; allowed "127.0.0.1/255.255.255.255" ; allowed "184.108.40.206/0.0.0.0" ; denied "127.0.0.1/0.0.0.0" ; denied "220.127.116.11/255.255.0.0" ; ) ; run ( ; start "G:/sb21/\\source\\examples\\runstart.bas" ; start the program in an asynchronous thread ; restart "G:/sb21/\\source\\examples\\runrestart.bas" ; same as start, but when the program terminates start it again ; ) errmsgdest 3 nolog 0 ; set this true not to use logs or ignore erroneouslog configuration log ( panic ( file "G:/sb21/\\httpdlog\\panic.log" ) app ( file "G:/sb21/\\httpdlog\\app.log" ) err ( file "G:/sb21/\\httpdlog\\err.log" ) hit ( file "G:/sb21/\\httpdlog\\hit.log" ) stat ( file "G:/sb21/\\httpdlog\\stat.log" ) ) ; the error page when a page is not found msg404 """ <HTML> <HEAD> <TITLE>Error 404 page not found</TITLE> </HEAD> <BODY> <FONT FACE="Verdana" SIZE="2"> <H1>Page not found</H1> We regretfully inform you that the page you have requested can not be found on this server. <p> In case you are sure that this is a server configuration error, please contact <FONT SIZE="3"><TT>root@localhost</TT></FONT> </FONT> </BODY> </HTML> """ code404 "200 OK" ; the http error code for page not found. The default is 404 ; the program to run when a page is not found ;run404 "G:/sb21/\\source\\examples\\run404.bas" mt ( sleep 55 ) )