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
O2S Configuration Variables
Registry Address: Specifies the registry address.
Default: o2s.csail.mit.edu:7887
User (name): Specifies the user.
Default: The current user.
Location: Specifies the Entity's location.
Default: The current user's office, e.g., Steve's Office
Client Type: Specifies the Operating System/Platform.
Default: The detected platform.
Logging: Specifies how much debugging spew to output.
Allowed values, with increasing verbosity: critical (same as error), warning, info, debug, debug1, debug2, debug3.
Default: warning
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.
Command Line Switches
Environment Variables
~/.o2s (personal configuration file)
/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:
--o2s-registry-address : Registry Address
Example: python myO2Sfile.py --o2s-registry-address=elsie.csail.mit.edu:7887
--o2s-user : User name
Example: python myO2Sfile.py --o2s-user=Steve
--o2s-location : Location
Example: python myO2Sfile.py --o2s-location="32-G786"
--o2s-client-type : Device Type/Platform
Example: python myO2Sfile.py --o2s-client-type=iPAQ
--o2s-logging : Logging
Example: python myO2Sfile.py --o2s-logging=info
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:
O2S_REGISTRY_ADDRESS : Registry Address
O2S_USER : User
O2S_LOCATION : User's Location
O2S_CLIENT_TYPE : Device Type/Platform
O2S_LOGGING : Logging Verbosity Level
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.
O2S_REGISTRY_ADDRESS or REGISTRY_ADDRESS: Registry Address
O2S_USER or USER : User
O2S_LOCATION or LOCATION : User's Location
O2S_CLIENT_TYPE or CLIENT_TYPE : Device Type/Platform
O2S_LOGGING or LOGGING : Logging Verbosity Level
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().