#1051 closed enhancement (fixed)
centralized trac.ini
Reported by: | Manuzhai | Owned by: | Christopher Lenz |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | web frontend/mod_python | Version: | 0.8 |
Severity: | normal | Keywords: | |
Cc: | manuzhai@…, trac.tickets@…, dserodio@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
I was just trying to trick the mod_python handler into displaying a prettier page where you can choose from different projects, and while I got it done in the end, it was not a very pretty solution. This was mainly due to the fact that only the env knows about things like template locations, htdocs_location, and other stuff.
To make it easier to use Trac with multiple projects, I think Trac should have a central configuration file (e.g., /etc/trac.ini
) which contains defaults for all the options in the env trac.ini
that are reasonable. These options can than be overwritten in env-specific trac.ini
's.
Would this be as useful as I think? I could whip up a patch if necessary. :)
Attachments (8)
Change History (27)
by , 20 years ago
Attachment: | centralini.diff added |
---|
comment:1 by , 20 years ago
Component: | general → mod_python frontend |
---|---|
Milestone: | 0.9 |
Owner: | changed from | to
Priority: | normal → low |
Summary: | Trac needs a central config file → Customizable project listing |
Well, trac.siteconfig
already knows the location of all the default directories, and the other stuff is really environment specific. I don't see how a central configuration file would help very much there. The centralini.diff
patch will obviously only work on Unix systems, and hardcoding the path isn't pretty.
A proper solution would be (IMHO) to add a PythonOption like TracEnvIndexTemplate to the mod_python handler. If you want to get fancy, you could allow setting constant HDF values for use in the template from the Apache config, like:
<Location /projects> SetHandler mod_python PythonHandler trac.ModPythonHandler PythonOption TracUriRoot /projects PythonOption TracEnvParentDir "/var/trac" PythonOption TracEnvIndexTemplate "/var/trac/index.cst" PythonOption TracTemplateVar "htdocs_common = /trac" </Location>
comment:3 by , 20 years ago
Summary: | Customizable project listing → centralized trac.ini |
---|
I've been thinking something like this would be useful for me as well.
I think I'm going to try a solution that will look for a trac.ini in TracEnvParentDir (to avoid the hardcoded path) and will provide a sort of templating ability for using the project path in the central ini (e.g. repository_dir = /var/svn/<project>, though with a different syntax)
comment:4 by , 20 years ago
I've built an implementation of a templated index, following the idea that Chris gave above. Here's a link to my writeup: http://blog.mugfu.com/2005/03/29/template-ized-trac-indices/ The latest patch is in the comments there, and I'll attach a copy here as well.
comment:5 by , 20 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 20 years ago
I've checked code based on Jasons patch in [1498]. As that doesn't resolve the central trac.ini issue raised here, this ticket remains open.
by , 19 years ago
Attachment: | trac-global-config.diff added |
---|
Patch implementing global configuration "underlay" at <prefix>/share/trac/conf/trac.ini
.
by , 19 years ago
Attachment: | trac-global-config-2.diff added |
---|
Patch implementing global configuration "underlay" at <prefix>/share/trac/conf/trac.ini
(new patch includes updates to unit test)
comment:8 by , 19 years ago
This works with the following global configuration file, both with the plugin explicitly disabled and enabled.
[project] icon = swapoff.ico [disabled_components] acct_mgr = yes
by , 19 years ago
Attachment: | trac-global-config-3.diff added |
---|
Take 3, minus stupid bug. Unit tests completed successfully.
comment:9 by , 19 years ago
WebAdmin needs to be updated with the following patch, as removing the config element falls back on the site wide default, which may in fact itself be 'yes'.
-
webadmin/plugin.py
135 135 if is_enabled: 136 136 self.config.set('disabled_components', component, 'yes') 137 137 else: 138 self.config. remove('disabled_components', component)138 self.config.set('disabled_components', component, 'no') 139 139 self.log.info('%sabling component %s', 140 140 is_enabled and 'Dis' or 'En', component) 141 141 changes = True
by , 19 years ago
Attachment: | trac-global-config-4.diff added |
---|
After some feedback from cmlenz, this version seems to be quite unobtrusive
comment:10 by , 19 years ago
Cc: | added |
---|
comment:11 by , 19 years ago
Cc: | added |
---|
comment:12 by , 19 years ago
I don't understand the proposed solution: does the "centralized trac.ini" file set defaults for each project, or does it override values in each project's config?
comment:13 by , 19 years ago
It does not override, it is a fallback if a key does not exist in a Trac environment.
comment:14 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Priority: | low → high |
Status: | assigned → new |
I'll try integrating this. The component configuration and #2019 is making this higher priority, among other things.
comment:15 by , 19 years ago
Status: | new → assigned |
---|
comment:17 by , 19 years ago
It would be nice to have the Trac installation have a "central" trac.ini
and have trac-admin ... initenv
create just a minimal trac.ini
, so that the configuration for multiple Trac environments is kept centralized.
comment:18 by , 19 years ago
I'm willing to implement my previous suggestion, if the Trac developers think it's a good idea. I think just the [project]
section should be placed on a per-environment trac.ini
, the other settings may be kept centralized instead of repeated in all environments.
What do you think?
comment:19 by , 19 years ago
IMHO, it'd be nice to only override those settings that are not set in the central trac.ini or that are chosen to be different from those settings by the user of trac-admin.
Patch that adds a CENTRAL_CONFIG var.