| 743 | | conf_data = getattr(self, '_project_apache_conf_' + self.getConfig('vhost_mode', 'general')).__call__() % {'client_name' : infos['client'], |
| 744 | | 'project_name' : infos['short_name'], |
| 745 | | 'clients_root' : self.getConfig('clients_root', 'general'), |
| 746 | | 'ldap_password' : self.getConfig('ldap_password', 'general'), |
| 747 | | 'trac_install_dir' : self.getConfig('lib_dir', 'trac'), |
| 748 | | 'domain_name' : self.getConfig('domain', 'general')} |
| | 748 | conf_template = open('%s/%s.%s' % (self.getConfig('assets_dir', 'general'), 'apache.conf', self.getConfig('vhost_mode', 'general'))) |
| | 749 | conf_data = conf_template.read() % {'client_name' : infos['client'], |
| | 750 | 'project_name' : infos['short_name'], |
| | 751 | 'clients_root' : self.getConfig('clients_root', 'general'), |
| | 752 | 'ldap_password' : self.getConfig('ldap_password', 'general'), |
| | 753 | 'trac_install_dir' : self.getConfig('lib_dir', 'trac'), |
| | 754 | 'domain_name' : self.getConfig('domain', 'general')} |
| 756 | | |
| 757 | | def _project_apache_conf_single(self): |
| 758 | | return """ |
| 759 | | # |
| 760 | | # Client : %(client_name)s |
| 761 | | # Project : %(project_name)s |
| 762 | | # |
| 763 | | |
| 764 | | # -- Subversion |
| 765 | | <Location /%(client_name)s/%(project_name)s/svn> |
| 766 | | DAV svn |
| 767 | | SVNPath %(clients_root)s/%(client_name)s/var/svn/%(project_name)s |
| 768 | | AuthType Basic |
| 769 | | AuthName \"%(client_name)s :: %(project_name)s :: SVN\" |
| 770 | | |
| 771 | | # -- File based authentification |
| 772 | | AuthUserFile %(clients_root)s/%(client_name)s/var/svn/%(project_name)s/.htusers |
| 773 | | |
| 774 | | require valid-user |
| 775 | | </Location> |
| 776 | | |
| 777 | | # -- Trac |
| 778 | | <Location /%(client_name)s/%(project_name)s/trac> |
| 779 | | SetHandler mod_python |
| 780 | | PythonPath "['%(trac_install_dir)s'] + sys.path" |
| 781 | | PythonHandler trac.web.modpython_frontend |
| 782 | | PythonOption TracEnv %(clients_root)s/%(client_name)s/var/trac/%(project_name)s |
| 783 | | PythonOption TracUriRoot /%(client_name)s/%(project_name)s/trac |
| 784 | | SetEnv PYTHON_EGG_CACHE %(clients_root)s/%(client_name)s/tmp |
| 785 | | </Location> |
| 786 | | |
| 787 | | # Note : the match against "timeline" is needed to provide authenticated RSS feeds (see http://lab.clever-age.net/ticket/35) |
| 788 | | <LocationMatch /%(client_name)s/%(project_name)s/trac/(login|timeline)> |
| 789 | | AuthType Basic |
| 790 | | AuthName \"%(client_name)s :: %(project_name)s :: Trac\" |
| 791 | | |
| 792 | | # -- File based authentification |
| 793 | | # -- Users can be used using : |
| 794 | | # -- htpasswd2 %(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers <username> |
| 795 | | AuthUserFile %(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers |
| 796 | | |
| 797 | | Require valid-user |
| 798 | | </LocationMatch> |
| 799 | | |
| 800 | | # -- Files under src/ will be available on the web |
| 801 | | AliasMatch /%(client_name)s/%(project_name)s/src(.*) /home/%(client_name)s/htdocs/%(project_name)s$1 |
| 802 | | """ |
| 803 | | |
| 804 | | def _project_apache_conf_multi(self): |
| 805 | | return """ |
| 806 | | # |
| 807 | | # Client : %(client_name)s |
| 808 | | # Project : %(project_name)s |
| 809 | | # |
| 810 | | <VirtualHost *> |
| 811 | | |
| 812 | | # -- Virtual host general configuration |
| 813 | | ServerName %(client_name)s-%(project_name)s.%(domain_name)s |
| 814 | | |
| 815 | | # -- Subversion |
| 816 | | <Location /%(project_name)s/svn> |
| 817 | | DAV svn |
| 818 | | SVNPath %(clients_root)s/%(client_name)s/var/svn/%(project_name)s |
| 819 | | AuthType Basic |
| 820 | | AuthName \"%(client_name)s :: %(project_name)s :: SVN\" |
| 821 | | |
| 822 | | # -- File based authentification |
| 823 | | AuthUserFile %(clients_root)s/%(client_name)s/var/svn/%(project_name)s/.htusers |
| 824 | | |
| 825 | | require valid-user |
| 826 | | </Location> |
| 827 | | |
| 828 | | # -- Trac |
| 829 | | <Location /%(project_name)s/trac> |
| 830 | | SetHandler mod_python |
| 831 | | PythonPath "['%(trac_install_dir)s'] + sys.path" |
| 832 | | PythonHandler trac.web.modpython_frontend |
| 833 | | PythonOption TracEnv %(clients_root)s/%(client_name)s/var/trac/%(project_name)s |
| 834 | | PythonOption TracUriRoot /%(project_name)s/trac |
| 835 | | SetEnv PYTHON_EGG_CACHE %(clients_root)s/%(client_name)s/tmp |
| 836 | | </Location> |
| 837 | | |
| 838 | | # Note : the match against "timeline" is needed to provide authenticated RSS feeds (see http://lab.clever-age.net/ticket/35) |
| 839 | | <LocationMatch /%(project_name)s/trac/(login|timeline)> |
| 840 | | AuthType Basic |
| 841 | | AuthName \"%(client_name)s :: %(project_name)s :: Trac\" |
| 842 | | |
| 843 | | # -- File based authentification |
| 844 | | # -- Users can be used using : |
| 845 | | # -- htpasswd2 %(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers <username> |
| 846 | | AuthUserFile %(clients_root)s/%(client_name)s/var/trac/%(project_name)s/.htusers |
| 847 | | |
| 848 | | Require valid-user |
| 849 | | </LocationMatch> |
| 850 | | |
| 851 | | # -- Files under src/ will be available on the web |
| 852 | | AliasMatch /%(project_name)s/src(.*) /home/%(client_name)s/htdocs/%(project_name)s$1 |
| 853 | | </VirtualHost> |
| 854 | | """ |