Re: [viewvc-users] Configurable config file location?
John Beranek <[email protected]>
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.user |
|---|---|
| Organization | John@Home |
| Message-ID | <4C486605.3040601__48457.2638212287$1279813141$gmane$org@redux.org.uk> |
On 22/07/10 16:08, John Beranek wrote: > On 22/07/10 16:05, John Beranek wrote: >> On 21/07/10 20:32, C. Michael Pilato wrote: >>> On 07/19/2010 04:26 PM, John Beranek wrote: >>>> My thought was that I'd change the code to allow the config file >>>> location to be overridden by an environment variable. Looking at the >>>> code it looks like there's already some kind of support for this. Is it >>>> true that I only need to change all the places that define CONF_PATHNAME >>>> to define it as "None"? >>>> >>>> If so, I could then set VIEWVC_CONF_PATHNAME in the Apache config, and >>>> have multiple "viewvc.conf" files, one for each site. This would >>>> certainly be an advance. >>> >>> Yup. You can do that today. >> > [snip] >> >> I've implemented a nasty hack, diff attached - doesn't allow for more >> than one ViewVC installation per machine, but that's currently not a >> requirement for me. > > Hmm, I just realised that my hack doesn't actually implement a fallback > to loading viewvc.conf - so it's even nastier than I first though. ;) Fixed - a 2nd patch attached, FYI. John. -- John Beranek To generalise is to be an idiot. http://redux.org.uk/ -- William Blake ------------------------------------------------------ http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2636964 To unsubscribe from this discussion, e-mail: [[email protected]].
diff2.txt
(text/plain, 976 B)
Index: lib/viewvc.py
===================================================================
RCS file: /home/sources/cvsroot/Admin/website/cgi-bin/viewvc/lib/viewvc.py,v
retrieving revision 1.2
diff -u -r1.2 viewvc.py
--- lib/viewvc.py 2010/07/19 21:33:31 1.2
+++ lib/viewvc.py 2010/07/22 15:37:11
@@ -4267,11 +4267,17 @@
def load_config(pathname=None, server=None):
debug.t_start('load-config')
+ import socket
+
if pathname is None:
pathname = (os.environ.get("VIEWVC_CONF_PATHNAME")
or os.environ.get("VIEWCVS_CONF_PATHNAME")
or os.path.join(os.path.dirname(os.path.dirname(__file__)),
- "viewvc.conf"))
+ "viewvc.conf-" + socket.gethostname()))
+
+ if not os.path.isfile(pathname):
+ pathname = os.path.join(os.path.dirname(os.path.dirname(__file__)),
+ "viewvc.conf")
cfg = config.Config()
cfg.set_defaults()