Dave Cinege Git Repo thesaurus / master thesauruscfg_sample.cfg

Tree @master (Download .tar.gz)

thesauruscfg_sample.cfg @masterraw · history · blame

	Copyright (c) 2019 Dave Cinege
	Licensed under the Apache License, Version 2.0

VERSION = 20191113

This is the sample configuration file and specification document
for Python ThesaurusCfg, which utilizes the Thesaurus mapping datatype.

ThesaurusCfg file format is generally very similar in structure to the INI
file format used by Python ConfigParser, with some major differences.

Multi line Comments (doc strings) are supported, using double or single
triple-quotes. Triple quotes should start at the begining of a line,
but may end anywhere.

ThesaurusCfg is designed to work with dot seperated (Keypath) configuration
trees (nested ThesaurusCfg objects). 'Sections' may be used as a
keypath prefix for easier human parsing.

For example:
	a.b.c.v0 = 0
	a.b.c.v1 = 0
	a.b.c.v2 = 0

Can also be writen as:
	v0 = 0
	v1 = 0
	v2 = 0

To reset the keypath prefix use empty brackets on a line:

Keypath's and Sections must start at the beginng of a line

Lines take the form of:
Arbitrary whitespace may exist between any tokens:
	keypath  ( optional_coercion_method )  =  value

Value coercion methods are defined in ThesaurusCfg itself and
not explained here. 

Since the keypath is split on '.' it is a good idea to avoid dots in
key names. However if you must use dots (or other bad idea characters,
like whitespace) in a key name is it supported by quoting.

For example:	
	admin.'joe doe'.phone = 867-5309
	admin.'joe doe'.email = joe@doe.org

The parser strips at most 1 whitespace charter to the right of the value
For example:
	a = hello	== 'hello'
	a=hello		== 'hello'
	a =  hello	== ' hello'

Comments on the right side of single line keypath/value will be
stripped prior to the possible stripping of any whitespace.

	a = hello	# Lets make a equal hello
# Single line comment

# Simple key values using coercion methods
abc		(static_int)	= 123
xyz		(int)		= 678
myitemlist	(str_list)	= "Item 1's" "'Item_2'" "Item 3" "Item_4"
mybool		(str_to_bool)	= yes

# Keypath and value
a.bc		(static_int)	= 456
program.name	= thesauruscfg_sample.py

# keypath and multi-line value
	This program is to test the functionality of the ThesaurusCfg
	Python module. We prefer ':\n' value delimiters for multi-line.

# Using a keypath prefix 'section'. 'program.name' and
# 'program.description' defined above will already be here.
version		= 3.0
release		= 20191112
author		= Dave Cinege
licence		= Apache 2.0

# Reset (clear) the keypath prefix 'section'. While you can do this,
# it's of course cleaner to keep the root level keys all together.
# Remember that Thesaurus is ORDERED so this will define after the above
# keypaths, and not right after the orginal root level keys.
abc_2		(static_int)	= 1234

# We will apply these defaults to the below gateways using Thesaurus.mesh(),
# so that every gateway always has the default values, without having to
# list them multiple times. 
table			= 10
ifname 			= eth0
router 		(ipv4)	=
dns 		(ipv4)	=
inkbps 		(int)	= 99000
outkbps 	(int)	= 99000

router			=

ifname			= eth2
router			=

router			=

'mercury.mydom.org'.ip	=
'saturn.mydom.org'.ip	=
'venus.mydom.org'.ip	=

ip			=
router			=
	Primary host to access the universe.
	Replaced keyboard 20170104

## Sectional inheritance: defaults.gateways always merged first
#router			=