46
46
return '/etc/ivle/ivle.conf'
47
47
raise RuntimeError("Could not find IVLE config file")
49
conffile = search_conffile()
50
conffile = search_conffile()
51
except RuntimeError, e:
52
raise ImportError(str(e))
50
54
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]
56
# This dict maps legacy config option names to new config option paths
57
# ('section/option_name')
59
'root_dir': 'urls/root',
60
'prefix': 'paths/prefix',
61
'data_path': 'paths/data',
62
'log_path': 'paths/logs',
63
'python_site_packages_override': 'paths/site_packages',
64
'public_host': 'urls/public_host',
65
'allowed_uids': 'os/allowed_uids',
66
'db_host': 'database/host',
67
'db_port': 'database/port',
68
'db_dbname': 'database/name',
69
'db_forumdbname': 'plugins/forum/dbname',
70
'db_user': 'database/username',
71
'db_password': 'database/password',
72
'auth_modules': 'auth/modules',
73
'ldap_url': 'auth/ldap_url',
74
'ldap_format_string': 'auth/ldap_format_string',
75
'subject_pulldown_modules': 'auth/subject_pulldown_modules',
76
'svn_addr': 'urls/svn_addr',
77
'usrmgt_host': 'usrmgt/host',
78
'usrmgt_port': 'usrmgt/port',
79
'usrmgt_magic': 'usrmgt/magic',
80
'forum_secret': 'plugins/forum/secret',
83
for legacyopt, newopt_path in CONFIG_OPTIONS.iteritems():
84
# Iterate over each segment of the path, and find the value in conf file
87
for seg in newopt_path.split('/'):
89
globals()[legacyopt] = value
91
globals()[legacyopt] = None
93
# XXX Munge some nice shiny new-style values into horrible old-style values
94
# IRONY: These have just been split from commas. We need to re-join it so that
95
# pulldown_subj and auth_modules can re-split them.
96
subject_pulldown_modules = ','.join(subject_pulldown_modules)
97
auth_modules = ','.join(auth_modules)
62
99
# XXX Convert db_port and usrmgt_port to int.
79
116
# 'site-packages' directory in Python, where Python libraries are to be
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)
118
if python_site_packages_override is None:
119
PYTHON_VERSION = sys.version[0:3] # eg. "2.5"
120
python_site_packages = os.path.join(prefix,
121
'lib/python%s/site-packages' % PYTHON_VERSION)
123
python_site_packages = python_site_packages_override
85
125
# In the local file system, where the student/user jails will be mounted.
86
126
# Only a single copy of the jail's system components will be stored here -