aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/templates/vhost_repository.conf
blob: b5f2fa0428ccd6402266ed9e219ab0ef03596c74 (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
<%-
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')
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]

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

<%- if distro['no_mirror'] -%>
	Alias /<%= distribdir %>/<%= distroname %>/ "<%= bootstrap_reporoot %>/<%= distroname %>/"
<%- end -%>

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

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