35
conf = ivle.config.Config(plugins=False)
36
except ivle.config.ConfigError, e:
37
raise ImportError(str(e))
39
# This dict maps legacy config option names to new config option paths
40
# ('section/option_name')
42
'root_dir': 'urls/root',
43
'prefix': 'paths/prefix',
44
'data_path': 'paths/data',
45
'log_path': 'paths/logs',
46
'python_site_packages_override': 'paths/site_packages',
47
'public_host': 'urls/public_host',
48
'db_host': 'database/host',
49
'db_port': 'database/port',
50
'db_dbname': 'database/name',
51
'db_user': 'database/username',
52
'db_password': 'database/password',
53
'auth_modules': 'auth/modules',
54
'ldap_url': 'auth/ldap_url',
55
'ldap_format_string': 'auth/ldap_format_string',
56
'subject_pulldown_modules': 'auth/subject_pulldown_modules',
57
'svn_addr': 'urls/svn_addr',
58
'usrmgt_host': 'usrmgt/host',
59
'usrmgt_port': 'usrmgt/port',
60
'usrmgt_magic': 'usrmgt/magic',
63
for legacyopt, newopt_path in CONFIG_OPTIONS.iteritems():
64
# Iterate over each segment of the path, and find the value in conf file
67
for seg in newopt_path.split('/'):
69
globals()[legacyopt] = value
71
globals()[legacyopt] = None
73
# XXX Munge some nice shiny new-style values into horrible old-style values
74
# IRONY: These have just been split from commas. We need to re-join it so that
75
# pulldown_subj and auth_modules can re-split them.
76
subject_pulldown_modules = ','.join(subject_pulldown_modules)
77
auth_modules = ','.join(auth_modules)
32
def search_conffile():
34
Search for the config file, and return it as a filename.
35
1. Environment var IVLECONF (full filename).
37
3. /etc/ivle/ivle.conf
39
if 'IVLECONF' in os.environ:
40
fname = os.environ['IVLECONF']
41
if os.path.exists(fname):
43
if os.path.exists('./etc/ivle.conf'):
44
return './etc/ivle.conf'
45
if os.path.exists('/etc/ivle/ivle.conf'):
46
return '/etc/ivle/ivle.conf'
47
raise RuntimeError("Could not find IVLE config file")
49
conffile = search_conffile()
50
conf = configobj.ConfigObj(conffile)
52
CONFIG_OPTIONS = ('root_dir', 'prefix', 'data_path', 'log_path',
53
'public_host', 'allowed_uids', 'db_host', 'db_port', 'db_dbname',
54
'db_forumdbname', 'db_user', 'db_password', 'auth_modules', 'ldap_url',
55
'ldap_format_string', 'subject_pulldown_modules', 'svn_addr',
56
'usrmgt_host', 'usrmgt_port', 'usrmgt_magic', 'forum_secret'
59
for opt in CONFIG_OPTIONS:
60
globals()[opt] = conf[opt]
62
# XXX Convert db_port and usrmgt_port to int.
64
db_port = int(db_port)
65
usrmgt_port = int(usrmgt_port)
79
67
# Additional auto-generated config options
91
79
# 'site-packages' directory in Python, where Python libraries are to be
93
if python_site_packages_override is None:
94
PYTHON_VERSION = sys.version[0:3] # eg. "2.5"
95
python_site_packages = os.path.join(prefix,
96
'lib/python%s/site-packages' % PYTHON_VERSION)
98
python_site_packages = python_site_packages_override
81
PYTHON_VERSION = sys.version[0:3] # eg. "2.5"
82
python_site_packages = os.path.join(prefix,
83
'lib/python%s/site-packages' % PYTHON_VERSION)
100
85
# In the local file system, where the student/user jails will be mounted.
101
86
# Only a single copy of the jail's system components will be stored here -