Possible to route to multiple subversion repositories without the need of individual virtual hosts?

StackOverflow https://stackoverflow.com/questions/4971818

Frage

I'm just wondering if it's possible, and if so could someone lead me into the right direction please?

Basically here's what my current Linux box is doing:

<VirtualHost *:443>
    ServerName co.svnr.net
    ServerAdmin admin@svnr.net
    ServerAlias co

    <Location /shauny/test>
        DAV svn
        SVNPath /home/svn/public/shauny/test
        AuthName "Test repository"
    </Location>

    #a million other Locations later....

    SSLEngine on
    SSLCertificateFile /home/certs/svnr/server.crt
    SSLCertificateKeyFile /home/certs/svnr/server.key
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown 
</VirtualHost>

This is great and working, but it's just not feasible for say 50+ svn repositories. The ideal solution would to to point at say a Handler in PHP5 (whilst hosted on Linux machine) which accepts the username/repository in the superglobal $_GET and then redirects them to the repository (if it exists, otherwise redirect to 404).

But... is that even possible?
Can PHP5 read Subversion repositories and authentication?

Having PHP5 handle them would be more feasible in my opinion as I can generate some logs based on usage etc...

Much thanks guys, if you're unclear on anything let me know.

War es hilfreich?

Lösung

We had this sort of set up on our dev box (admittedly with only 3 repos) and we just set the Location directive to point to the subversion root and used SVNParentPath:

<Location /shauny>
        DAV svn
        SVNParentPath /home/svn/public/shauny
        AuthName "Test repository"
</Location>

Andere Tipps

Yes, it is possible.

Look into SVNParentPath. It probably is what you seek. Don't know how well it will play with your virtual host setup, and you might have to move directories around (if they don't share a parent) but it's probably a step in the right direction.

The only issues come in when you need different Location based settings, like if you were authenticating each repo with a different Auth Name. In that case, it might be better to leave the config untouched.

As far as wrapping the SVN module through a PHP interface to add PHP code willy-nilly. While it should work in theory, I'd avoid it in practice. SVN logging of any kind can be done on a per-repository basis by adding in pre/post hooks in the commit, read, etc. operations. Global "every repo" logging can be better handled by adding Apache directives.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top