Edgewall Software

Opened 19 years ago

Last modified 18 years ago

#1051 closed enhancement

centralized trac.ini — at Version 7

Reported by: Manuzhai Owned by: Matthew Good
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. :)

Change History (13)

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@…, 19 years ago

Attachment: trac-global-config.diff added

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

by trac-form@…, 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)

Note: See TracTickets for help on using tickets.