Koozali.org: home of the SME Server

Obsolete Releases => SME 9.x Contribs => Topic started by: mpfj on December 07, 2017, 03:39:52 PM

Title: Can I change SVN web path ?
Post by: mpfj on December 07, 2017, 03:39:52 PM
Currently testing a new SVN installation, and I see the repos are all accessed via HTTP as http://<server>/<repo>.

Is there any way to change this so the repos appear as http://<server>/svn/<repo> ?

Or, even better, if each repo could have its own HTTP path ... e.g.

http://<server>/svn/companyA/repo1
http://<server>/svn/companyA/repo2
http://<server>/svn/companyB/repo5
... etc ...
Title: Re: Can I change SVN web path ?
Post by: Stefano on December 07, 2017, 04:18:42 PM
moving to contribs section
Title: Re: Can I change SVN web path ?
Post by: ReetP on December 07, 2017, 04:58:50 PM
Currently testing a new SVN installation, and I see the repos are all accessed via HTTP as http://<server>/<repo>.

Is there any way to change this so the repos appear as http://<server>/svn/<repo> ?

Or, even better, if each repo could have its own HTTP path ... e.g.

http://<server>/svn/companyA/repo1
http://<server>/svn/companyA/repo2
http://<server>/svn/companyB/repo5
... etc ...

I guess you would probably need a custom http template somewhere.
Title: Re: Can I change SVN web path ?
Post by: Jean-Philippe Pialasse on December 07, 2017, 08:22:01 PM
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/28SubversionContent /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/

vim /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/28SubversionContent


then change
Code: [Select]
                $OUT .= "    RewriteRule ^/$key(/.*|\$)    https://%{HTTP_HOST}/$key\$1 [L,R]\n\n";to
Code: [Select]
                $OUT .= "    RewriteRule ^/svn/$key(/.*|\$)    https://%{HTTP_HOST}/svn/$key\$1 [L,R]\n\n";

and
Code: [Select]
                    $OUT .= "    <Location /$key>\n\n";to
Code: [Select]
                    $OUT .= "    <Location /svn/$key>\n\n";

and as soon as you found a way to get out of vim  :D, your are done  by just doing :

Code: [Select]
signal-event remoteacces-update
Title: Re: Can I change SVN web path ?
Post by: ReetP on December 07, 2017, 08:26:43 PM
Ahhh so simple :-)

mc/mcedit to save all that vim nonsense ;-)

Title: Re: Can I change SVN web path ?
Post by: Jean-Philippe Pialasse on December 07, 2017, 08:37:08 PM
Ahhh so simple :-)

mc/mcedit to save all that vim nonsense ;-)

this not non sense :D this is a trap

thinking of it it could be a NFR : adding a variable there to allow to set a path
Code: [Select]
my $path = $modDAVSVN->prop("path") || '';
$path = $path."/" if ( substr($path, -1) ne "/" &&  $path ne "" );

 $OUT .= "    RewriteRule ^/$path$key(/.*|\$)    https://%{HTTP_HOST}/$path$key\$1 [L,R]\n\n";

                    $OUT .= "    <Location /$path$key>\n\n";



then set your path
Code: [Select]
config setprop modDAVSVN path svn
signal-event remoteacces-update
Title: Re: Can I change SVN web path ?
Post by: mpfj on December 08, 2017, 05:44:42 PM
Finally got something working which allowed me to have a path per repo (using a "Path" property)

In 28SubversionContent I added:-

Code: [Select]
my $path = $properties{'Path'} || '';
$path = $path."/" if ( substr($path, -1) ne "/" && $path ne "" );

And changed
Code: [Select]
$OUT .= " RewriteRule ^/$key(/.*|\$) https://%{HTTP_HOST}/$key\$1 [L,R]\n\n";
$OUT .= " <Location /$key>\n\n";

… to …
Code: [Select]
$OUT .= " RewriteRule ^/$path$key(/.*|\$) https://%{HTTP_HOST}/$path$key\$1 [L,R]\n\n";
$OUT .= " <Location /$path$key>\n\n";

Thanks for the assistance  :-P
Title: Re: Can I change SVN web path ?
Post by: Jean-Philippe Pialasse on December 08, 2017, 07:55:37 PM
that is also an interesting approach, we could mix both.

allow to set one for all, and overide the value per repo.