aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/templates/vhost_repository.conf
blob: e082ffcafefc8970cffb33a435c2fe9b3def919f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<%-
mirror_root = scope.lookupvar('buildsystem::var::repository::mirror_root')
mirror_reporoot = scope.lookupvar('buildsystem::var::repository::mirror_reporoot')
bootstrap_reporoot = scope.lookupvar('buildsystem::var::repository::bootstrap_reporoot')
distribdir = scope.lookupvar('buildsystem::var::repository::distribdir')
repo_allow_from_ips = scope.lookupvar('buildsystem::var::distros::repo_allow_from_ips')
repo_allow_from_domains = scope.lookupvar('buildsystem::var::distros::repo_allow_from_ips')
distros = scope.lookupvar('buildsystem::var::distros::distros')
-%>
<VirtualHost *:80>
        ServerName <%= scope.lookupvar('buildsystem::var::repository::hostname') %>
        DocumentRoot <%= mirror_root %>

        # Some simple API to check existence of SRPMs for QA
        RewriteEngine On

        RewriteCond /distrib/bootstrap/distrib/$2/SRPMS/$3/$1s_testing/$4.src.rpm -f
        RewriteRule ^/qa/checksrpm/(update|backport)/([1-9][0-9]*)/([a-z_]+)/([^/]+)$ http://repository.mageia.org/qa/checksrpm/found [L,R=302]

        RewriteRule ^/qa/checksrpm/ - [L,G]

<%-
	if repo_allow_from_ips != nil || repo_allow_from_domains != nil then
	    access_requires = [ 'all denied' ]
	    if repo_allow_from_ips != nil then
		for allow in repo_allow_from_ips do
		    access_requires << 'ip ' + allow
		end
	    end
	    if repo_allow_from_domains != nil then
		for allow in repo_allow_from_domains do
		    access_requires << 'host ' + allow
		end
	    end
	else
	    access_requires = [ 'all granted' ]
	end
%>
	Alias /bootstrap/ "<%= bootstrap_reporoot %>/"
<%-
    distros.keys.sort.each{|distroname|
       distro = distros[distroname]
       if distro['no_mirror'] -%>
	Alias /<%= distribdir %>/<%= distroname %>/ "<%= bootstrap_reporoot %>/<%= distroname %>/"
<%-
       end
    }
-%>

	<Directory  <%= bootstrap_reporoot %>>
          Header append Cache-Control "public, must-revalidate"
<%-
        for req in access_requires do
-%>
          Require <%= req %>
<%-
        end
-%>
          Options Indexes FollowSymLinks
        </Directory>

	<Directory  <%= mirror_root %>>
          Header append Cache-Control "public, must-revalidate"
<%-
	for req in access_requires do
-%>
          Require <%= req %>
<%-
        end
-%>
          Options Indexes FollowSymLinks
        </Directory>
</VirtualHost>