Format of the configuration file with initial values

indexsoft configurator automatically builds web based dialogs (web forms) for creating and modifing perl configuration files for your applications (we call them 'pure perl configuration files'). To build such dialogs indexsoft configurator uses configuration file with initial values. This files contains set of rules which define type of variable, how it will be stored in the pure perl configuration file and how it will be presented in web based dialogs.

Here is a few simple examples. Refer also to included 'example.ini' file.

Configuration file with initial values divided to sections. Sections name enclosed with {}:

	{Parameters to configure 1}
	...
	{Parameters to configure 2}
	...
	...

Each sections contains set of parameters to configure. Each parameter enclosed with []:

	{Parameters to configure 1}
	[Parameter 1]
	...
	[Parameter 3]
	...
	[Parameter 4]
	...
	...

Each parameters contains set of keys and values in format: key = value. Here is a list of all possible keys and values:

	{Parameters to configure 1}
	[Parameter 1]
	# comments starts with '#'
	# keys and values used to build web based dialogs:
	desc   = Text description of the parameter 1	
	type   = <text|password|radio|select|checkbox|textarea>
	text   = Text descriptions for each element, divided by ';' used if type is radio, select or checkbox
	texec  = Calculated text descriptions for each element, divided by ';' used if type is radio, select or checkbox
	vquote = <"|'>
	attr   = Additional attributes for selected type of HTML tag

	# keys and values used to crate pure perl configuration file:
	name   = variable_name
	var    = <$|@|%>
	value  = initial value of the configuring variable
	vexec  = calculated initial value of the configuring variable
	quote  = <q|qq|qw|qx|...>

Of course 'name' and 'value' will be used in web based dialogs as name of selected tag and its default value accordingly.

Key 'type':

	type   = text
	# tag <input type="text"> will be used in dialogs

	type   = password
	# tag <input type="password"> will be used in dialogs

	type   = radio
	# tag <input type="radio"> will be used in dialogs

	type   = checkbox
	# tag <input type="checkbox"> will be used in dialogs

	type   = select
	# tags <select></select> will be used in dialogs

	type   = textarea
	# tags <textarea></textarea> will be used in dialogs

Key 'vquote':

How to qoute value attribute in the tag. Auto detect by default. In most cases you can omit this key
	vquote = '
	# value will be enclosed by '': <input type="text" value=''>

	vquote = "
	# value will be enclosed by "": <input type="text" value="">

Key 'attr':

Attributes for HTML tag:
	type   = textarea
	attr   = rows=10 cols=50
	# <textarea rows=10 cols=50></textarea>

	type   = text
	attr   = style="width:100%;"
	# <input type="text" style="width:100%;">

Keys 'name', 'var' and 'quote':

Key 'name' is a name attribute for selected HTML tag and name of the perl variable simultaneously. Key 'var' can be '$', '@', and '%' define what variable will be stored in rure perl configuration file (variable, array or hash accordingly). By default key 'var' is always '$'. Key 'quote' define how value of the perl variable will be enclosed in pure perl configuration file. Default value for key 'quote' defined by indexsoft configurator parameters (after installed is 'qq' by default). If type is 'checkbox' key 'name' can contains multiple values (see example for key 'text').
	type   = text
	name   = SMTPPORT
	var    = $
	quote  = q
	# HTML tag: <input type="text" name="SMTPPORT">
	# Perl configfile: $SMTPSERVER = q{};

	type   = textarea
	name   = PRIORITY
	var    = @
	quote  = qq
	# HTML tag: <textarea name="PRIORITY"></textarea>
	# Perl configfile: @PRIORITY = qq{};

	type   = textarea
	name   = PRIORITY
	var    = %
	quote  = qw
	# HTML tag: <textarea name="PRIORITY"></textarea>
	# Perl configfile: %PRIORITY = qw{};

You can even use something like this:

	type   = textarea
	name   = FUNCTION
	var    = $
	quote  = eval q
	# HTML tag: <textarea name="FUNCTION"></textarea>
	# Perl configfile: $FUNCTION = eval q{};

Keys 'value' and 'vexec':

Value attribute for selected tag and value of the perl variable:
	type   = text
	name   = SMTPSERVER
	value  = mail.my_host.com
	quote  = q
	vquote = '
	var    = $
	attr   = style="width:100%;"
	# HTML tag: <input type="text" style="width:100%;" name="SMTPSERVER" value='mail.my_host.com'>
	# Perl configfile: $SMTPSERVER = q{mail.my_host.com};

Value key can contains multiple values if 'type' is select, radio or checkbox. In this case values devided by ';'. Defaul value enclosed by <>:

	type   = radio
	name   = SMTPSERVER
	value  = mail.my_host1.com;<mail.my_host2.com>;mail.my_host3.com
	vquote = '
	# HTML tags:
	# <input type="radio" name="SMTPSERVER" value='mail.my_host1.com'>
	# <input type="radio" name="SMTPSERVER" value='mail.my_host2.com' checked>
	# <input type="radio" name="SMTPSERVER" value='mail.my_host3.com'>

Keys 'vexec' and 'texec' can be used instead of the 'value' and 'text' keys. Value of the key 'vexec' contains perl expression which will be calculated and result of the calculation wil be used as value of the key 'value' (same for the 'texec'):

	type   = text
	name   = SERVER_OS
	vexec  = if ($ENV{'WINDIR'}) { $_ = 'Server OS is Windows' } else { $_ = 'Server OS is not Windows' }
	quote  = q
	# HTML tag and perl variable if server OS is Windows:
	#  <input type="text" name="SERVER_OS" value="Server OS is Windows">
	#  $SERVER_OS = q{Server OS is Windows};
	# HTML tag and perl variable if server OS is not Windows:
	#  <input type="text" name="SERVER_OS" value="Server OS is not Windows">
	#  $SERVER_OS = q{Server OS is not Windows};

or using 'texec' key for radio buttons:

	type = radio
	name   = SERVER_OS
	vexec = $_=($ENV{'WINDIR'}?('<win>;nix'):('win;<nix>'))
	texec = $_='Windows;Linux'
	# HTML tag and if server OS is Windows:
	#  <input type="radio" name="SERVER_OS" value="win" checked> Windows
	#  <input type="radio" name="SERVER_OS" value="nix">Linux
	# HTML tag and if server OS is not Windows:
	#  <input type="radio" name="SERVER_OS" value="win"> Windows
	#  <input type="radio" name="SERVER_OS" value="nix" checked>Linux

Keys 'text' and 'texec':

Used only for radio, select or checkbox tags (tags with choice). Contains description for each element. Descriptions divided by ';'
	type   = radio
	name   = SMTPSERVER
	value  = mail.my_host1.com;<mail.my_host2.com>;mail.my_host3.com
	text   = Open realy 1;My provider;Open realy 2
	vquote = '
	# HTML tags:
	# <input type="radio" name="SMTPSERVER" value='mail.my_host1.com'> Open realy 1
	# <input type="radio" name="SMTPSERVER" value='mail.my_host2.com' checked> My provider
	# <input type="radio" name="SMTPSERVER" value='mail.my_host3.com'> Open realy 2

	type   = checkbox
	name   = HTMLMESSAGE ; CONFIRMRC ; CONFIRMRD
	value  = 1;1;<1>
	text   = This is HTML message ; Confirm receipt ; Reading confirmation
	vquote = "
	# HTML tags:
	# <input type="checkbox" name="HTMLMESSAGE" value="1"> This is HTML message
	# <input type="checkbox" name="CONFIRMRC" value="1"> Confirm receipt
	# <input type="checkbox" name="CONFIRMRD" value="1" checked> Reading confirmation

Key 'texec' is calculated texts for calculated values. See keys 'value' and 'vexec' section above.

Key 'desc':

Description of the parameter.


www.indexsoft.com