Ticket #1051 (closed enhancement: fixed)
Opened 7 years ago
Last modified 6 years ago
centralized trac.ini
| Reported by: | Manuzhai | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | high | Milestone: | 0.9 |
| Component: | web frontend/mod_python | Version: | 0.8 |
| Severity: | normal | Keywords: | |
| Cc: | manuzhai@…, trac.tickets@…, dserodio@… | ||
| Release Notes: | |||
| API Changes: | |||
Description (last modified by cmlenz) (diff)
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
Change History
Changed 7 years ago by Manuzhai
- Attachment centralini.diff added
comment:1 Changed 7 years ago by cmlenz
- Component changed from general to mod_python frontend
- Milestone 0.9 deleted
- Owner changed from jonas to cmlenz
- Priority changed from normal to low
- Summary changed from Trac needs a central config file to 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:2 Changed 7 years ago by cmlenz
#1247 has been marked as duplicate of this ticket.
comment:3 Changed 7 years ago by Matthew Good <trac matt-good net>
- Summary changed from Customizable project listing to 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 Changed 7 years ago by jason@…
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.
Changed 7 years ago by jason@…
- Attachment idx_template.2.diff added
The patch for doing template-ized indices
Changed 7 years ago by jason@…
- Attachment idx_template.3.diff added
patch to cleanly apply to [1467] plus
comment:5 Changed 7 years ago by mgood
- Owner changed from cmlenz to mgood
- Status changed from new to assigned
comment:6 Changed 7 years ago by cmlenz
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.
comment:7 Changed 6 years ago by cmlenz
- Description modified (diff)
(Improved formatting of description)
Changed 6 years ago by trac-form@…
- Attachment trac-global-config.diff added
Patch implementing global configuration "underlay" at <prefix>/share/trac/conf/trac.ini.
Changed 6 years ago by trac-form@…
- 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 Changed 6 years ago by trac-form@…
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
Changed 6 years ago by trac-form@…
- Attachment trac-global-config-3.diff added
Take 3, minus stupid bug. Unit tests completed successfully.
comment:9 Changed 6 years ago by trac-form@…
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
Changed 6 years ago by trac-form@…
- Attachment trac-global-config-4.diff added
After some feedback from cmlenz, this version seems to be quite unobtrusive
comment:10 Changed 6 years ago by anonymous
- Cc trac.tickets@… added
comment:11 Changed 6 years ago by dserodio@…
- Cc dserodio@… added
comment:12 Changed 6 years ago by dserodio@…
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 Changed 6 years ago by trac-form@…
It does not override, it is a fallback if a key does not exist in a Trac environment.
comment:14 Changed 6 years ago by cmlenz
- Milestone set to 0.9
- Owner changed from mgood to cmlenz
- Priority changed from low to high
- Status changed from assigned to new
I'll try integrating this. The component configuration and #2019 is making this higher priority, among other things.
comment:15 Changed 6 years ago by cmlenz
- Status changed from new to assigned
comment:16 Changed 6 years ago by cmlenz
- Resolution set to fixed
- Status changed from assigned to closed
Implemented in [2335].
comment:17 Changed 6 years ago by dserodio@…
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 Changed 6 years ago by dserodio@…
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 Changed 6 years ago by thomas.jachmann@…
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.