Edgewall Software
Modify

Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#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 Christopher Lenz)

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)

centralini.diff (612 bytes ) - added by Manuzhai 19 years ago.
Patch that adds a CENTRAL_CONFIG var.
idx_template.2.diff (2.9 KB ) - added by jason@… 19 years ago.
The patch for doing template-ized indices
index.cs (1.2 KB ) - added by jason@… 19 years ago.
My sample index template
idx_template.3.diff (3.0 KB ) - added by jason@… 19 years ago.
patch to cleanly apply to [1467] plus
trac-global-config.diff (2.1 KB ) - added by trac-form@… 18 years ago.
Patch implementing global configuration "underlay" at <prefix>/share/trac/conf/trac.ini.
trac-global-config-2.diff (4.3 KB ) - added by trac-form@… 18 years ago.
Patch implementing global configuration "underlay" at <prefix>/share/trac/conf/trac.ini (new patch includes updates to unit test)
trac-global-config-3.diff (4.3 KB ) - added by trac-form@… 18 years ago.
Take 3, minus stupid bug. Unit tests completed successfully.
trac-global-config-4.diff (8.5 KB ) - added by trac-form@… 18 years ago.
After some feedback from cmlenz, this version seems to be quite unobtrusive

Download all attachments as: .zip

Change History (27)

by Manuzhai, 19 years ago

Attachment: centralini.diff added

Patch that adds a CENTRAL_CONFIG var.

comment:1 by Christopher Lenz, 19 years ago

Component: generalmod_python frontend
Milestone: 0.9
Owner: changed from Jonas Borgström to Christopher Lenz
Priority: normallow
Summary: Trac needs a central config fileCustomizable 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 by Christopher Lenz, 19 years ago

#1247 has been marked as duplicate of this ticket.

comment:3 by Matthew Good <trac matt-good net>, 19 years ago

Summary: Customizable project listingcentralized 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 jason@…, 19 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.

by jason@…, 19 years ago

Attachment: idx_template.2.diff added

The patch for doing template-ized indices

by jason@…, 19 years ago

Attachment: index.cs added

My sample index template

by jason@…, 19 years ago

Attachment: idx_template.3.diff added

patch to cleanly apply to [1467] plus

comment:5 by Matthew Good, 19 years ago

Owner: changed from Christopher Lenz to Matthew Good
Status: newassigned

comment:6 by Christopher Lenz, 19 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.

comment:7 by Christopher Lenz, 19 years ago

Description: modified (diff)

(Improved formatting of description)

by trac-form@…, 18 years ago

Attachment: trac-global-config.diff added

Patch implementing global configuration "underlay" at <prefix>/share/trac/conf/trac.ini.

by trac-form@…, 18 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 trac-form@…, 18 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 trac-form@…, 18 years ago

Attachment: trac-global-config-3.diff added

Take 3, minus stupid bug. Unit tests completed successfully.

comment:9 by trac-form@…, 18 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

     
    135135                if is_enabled:
    136136                    self.config.set('disabled_components', component, 'yes')
    137137                else:
    138                     self.config.remove('disabled_components', component)
     138                    self.config.set('disabled_components', component, 'no')
    139139                self.log.info('%sabling component %s',
    140140                              is_enabled and 'Dis' or 'En', component)
    141141                changes = True

by trac-form@…, 18 years ago

Attachment: trac-global-config-4.diff added

After some feedback from cmlenz, this version seems to be quite unobtrusive

comment:10 by anonymous, 18 years ago

Cc: trac.tickets@… added

comment:11 by dserodio@…, 18 years ago

Cc: dserodio@… added

comment:12 by dserodio@…, 18 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 trac-form@…, 18 years ago

It does not override, it is a fallback if a key does not exist in a Trac environment.

comment:14 by Christopher Lenz, 18 years ago

Milestone: 0.9
Owner: changed from Matthew Good to Christopher Lenz
Priority: lowhigh
Status: assignednew

I'll try integrating this. The component configuration and #2019 is making this higher priority, among other things.

comment:15 by Christopher Lenz, 18 years ago

Status: newassigned

comment:16 by Christopher Lenz, 18 years ago

Resolution: fixed
Status: assignedclosed

Implemented in [2335].

comment:17 by dserodio@…, 18 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 dserodio@…, 18 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 thomas.jachmann@…, 18 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.