6.5. Configuration

Tycoon programs are configured using a series of files containing Python code that sets various variables. Tycoon programs use specific variables to configure themselves. For example, the variable BankHostName contains the host name of the bank.

The configuration files can contain any Python code, including import statements. These files are executed to obtain the configuration variables. Files that are executed later can override the values set by files that are executed earlier. In some cases, a configuration variable that is set earlier requires a configuration value set by a later file. The configuration system runs two passes to provide this ability. The earlier variable must be set to a string with a string formatting mapping key of the same name as the later variable. For example, this allows NonceFileName to use the value of BankAccountName, even though BankAccountName is set later:


NonceFileName = "˜/.tycoon/%(BankAccountName)s/nonce"

In addition, the dictionary variable SecondPassOptions must have a key with the same name as the earlier variable set to True:


SecondPassOptions['NonceFileName'] = True

The specific set of configuration files used varies from program to program, but in general, there is a non-program-specific file name (tycoon.conf) and a program-specific file name (e.g., tycoon_dist_auc.conf) and there is a system-wide file system path (/etc) and a user-specific path (˜/.tycoon). The files are read in the following order:

  1. non-program-specific file name at the system-wide location

  2. program-specific file name at the system-wide location

  3. non-program-specific file name at the user-specific location

  4. program-specific file name at the user-specific location

To change this behavior, use the --config_search_path option with a list containing the new search path. For example, to apply the tycoon.conf file in the current directory and then the user-specific file:

[asmith@alicehost ~]# tycoon --config_path "('./', '˜/.tycoon')" ...

For example, for the tycoon client program, the configuration files are read in the following order:

  1. /etc/tycoon/tycoon.conf

  2. ˜/tycoon.conf

[Note]Note

There are no program-specific file configuration files for the tycoon client.