ConfigureO2S

MOST IMPORTANT

After checking out O2S, first add/modify the PYTHONPATH environment variable (best done in your startup dotfile). For bash users:

EXPORT PYTHONPATH=[path to your o2s]/lang-support/python/

For tcsh:

setenv PYTHONPATH [path to your o2s]/lang-support/python/

Windows users:

Right-click on My Computer, select Properties. Select the Advanced tab and click the Environment Variables button. Make a new System Variable:

 Variable name: PYTHONPATH
 Variable value: C:/home/username/o2s/lang-support/python/

The rest (as follows) is optional.


Upon startup, O2S checks various places for configuration variables. Specifying configuration variables is completely optional! If these variables aren't specified, the system sets them to reasonable default values.

TODO: After implementing local registry detection, update documentation to 
reflect new "Registry Address" semantics.

Contents

  1. O2S Configuration Variables
  2. Variable Resolution order
    1. Command Line Switches
    2. Environment Variables
    3. ~/.o2s dotfile
    4. /etc/o2s sitewide configuration file
  3. Extending O2S Configuration Variables

O2S Configuration Variables

Once O2S is running, the value of these variables are available inside system.o2s_globals.

Variable Resolution order

There are several methods for specifying the configuration variables; below is the precedence for these methods, in descending order. Once a variable is specified in any of the methods, no further resolution is done.

  1. Command Line Switches

  2. Environment Variables

  3. ~/.o2s (personal configuration file)

  4. /etc/o2s (site-wide configuration file)

Command Line Switches

Command line switches override all variables set by other methods; the switches are generally useful for overriding variables from their default values (or those specified in dotfiles). The switches are:

You may specify as few or as many switches as necessary:

% python myO2Sfile.py --o2s-registry-address=elsie.csail.mit.edu:7887 --o2s-user=Steve --o2s-location="32-G786" --o2s-logging=info

Environment Variables

Environment variables are checked following the command-lind switches. Environment variables are typically useful for overriding certain variables temporarily during a session. They are:

Here is an example for setting environment variables:

bash% export O2S_REGISTRY_ADDRESS=elsie.csail.mit.edu:7887
bash% export O2S_USER=Steve
bash% export O2S_LOCATION=32-G786
bash% export O2S_CLIENT_TYPE=iPAQ
bash% export O2S_LOGGING=info

~/.o2s dotfile

The ~/.o2s configuration file is useful for storing more permanent settings. The file follows the standard Windows INI format.

Here's an example ~/.o2s file:

# this is a comment
[DEFAULT]
REGISTRY_ADDRESS = elsie.csail.mit.edu:7887
USER = Steve
LOCATION = 32-G786
DEVICE_TYPE = iPAQ
LOGGING = info

Note: it is important that these variables fall under the [default] heading. (Not: [defaultS])

/etc/o2s sitewide configuration file

The /etc/o2s file is a site-wide configuration file for storing system defaults. The file format is exactly the same as the ~/.o2s file. Here's an example /etc/o2s file that specifies the location for the host:

# this is a comment
[DEFAULT] 
LOCATION = 32-G786

Extending O2S Configuration Variables

To add more O2S configuration variables to the mix, modify system.init.o2s_init.make_settings_parser().

last edited 2006-09-05 19:10:56 by HubertPham