django-orchestra/orchestra/contrib/websites/settings.py

130 lines
3.9 KiB
Python
Raw Permalink Normal View History

from django.utils.translation import gettext_lazy as _
2014-05-08 16:59:35 +00:00
2015-05-04 19:52:53 +00:00
from orchestra.contrib.settings import Setting
from orchestra.core.validators import validate_ip_address
2014-05-08 16:59:35 +00:00
2015-04-26 13:53:00 +00:00
from .. import websites
2015-04-27 14:54:17 +00:00
_names = ('id', 'pk', 'home', 'user', 'group', 'site_name', 'protocol')
_log_names = _names + ('unique_name',)
2015-04-26 13:53:00 +00:00
WEBSITES_UNIQUE_NAME_FORMAT = Setting('WEBSITES_UNIQUE_NAME_FORMAT',
2015-04-27 14:54:17 +00:00
default='%(user)s-%(site_name)s',
help_text="Available fromat names: <tt>%s</tt>" % ', '.join(_names),
validators=[Setting.string_format_validator(_names)],
)
WEBSITES_PROTOCOL_CHOICES = Setting('WEBSITES_PROTOCOL_CHOICES',
default=(
('http', "HTTP"),
('https', "HTTPS"),
('http/https', _("HTTP and HTTPS")),
('https-only', _("HTTPS only")),
),
validators=[Setting.validate_choices]
)
2014-05-08 16:59:35 +00:00
2015-03-04 21:06:16 +00:00
WEBSITES_DEFAULT_PROTOCOL = Setting('WEBSITES_DEFAULT_PROTOCOL',
default='http',
2015-04-26 13:53:00 +00:00
choices=WEBSITES_PROTOCOL_CHOICES
)
2015-03-10 21:51:10 +00:00
2014-05-08 16:59:35 +00:00
WEBSITES_DEFAULT_IPS = Setting('WEBSITES_DEFAULT_IPS',
default=('*',)
)
2014-05-08 16:59:35 +00:00
2014-10-17 15:23:02 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_DOMAIN_MODEL = Setting('WEBSITES_DOMAIN_MODEL',
'domains.Domain',
validators=[Setting.validate_model_label]
)
2014-05-08 16:59:35 +00:00
WEBSITES_ENABLED_DIRECTIVES = Setting('WEBSITES_ENABLED_DIRECTIVES',
(
2015-04-26 13:53:00 +00:00
'orchestra.contrib.websites.directives.Redirect',
'orchestra.contrib.websites.directives.Proxy',
'orchestra.contrib.websites.directives.ErrorDocument',
'orchestra.contrib.websites.directives.SSLCA',
'orchestra.contrib.websites.directives.SSLCert',
'orchestra.contrib.websites.directives.SSLKey',
'orchestra.contrib.websites.directives.SecRuleRemove',
'orchestra.contrib.websites.directives.SecEngine',
'orchestra.contrib.websites.directives.WordPressSaaS',
'orchestra.contrib.websites.directives.DokuWikiSaaS',
'orchestra.contrib.websites.directives.DrupalSaaS',
'orchestra.contrib.websites.directives.MoodleSaaS',
2015-04-26 13:53:00 +00:00
),
# lazy loading
2016-02-09 12:17:42 +00:00
choices=lambda : ((d.get_class_path(), d.get_class_path()) for d in websites.directives.SiteDirective.get_plugins(all=True)),
2015-04-26 13:53:00 +00:00
multiple=True,
)
2014-05-08 16:59:35 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_BASE_APACHE_CONF = Setting('WEBSITES_BASE_APACHE_CONF',
'/etc/apache2/'
)
2014-05-08 16:59:35 +00:00
2014-10-17 20:03:41 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_WEBALIZER_PATH = Setting('WEBSITES_WEBALIZER_PATH',
'/home/httpd/webalizer/'
)
2014-05-08 16:59:35 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_WEBSITE_WWW_ACCESS_LOG_PATH = Setting('WEBSITES_WEBSITE_WWW_ACCESS_LOG_PATH',
2015-04-27 14:54:17 +00:00
'/var/log/apache2/virtual/%(unique_name)s.log',
help_text="Available fromat names: <tt>%s</tt>" % ', '.join(_log_names),
validators=[Setting.string_format_validator(_log_names)],
)
2014-11-20 15:34:59 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_WEBSITE_WWW_ERROR_LOG_PATH = Setting('WEBSITES_WEBSITE_WWW_ERROR_LOG_PATH',
2015-04-27 14:54:17 +00:00
'',
help_text="Available fromat names: <tt>%s</tt>" % ', '.join(_log_names),
validators=[Setting.string_format_validator(_log_names)],
)
2015-03-02 10:37:25 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_TRAFFIC_IGNORE_HOSTS = Setting('WEBSITES_TRAFFIC_IGNORE_HOSTS',
('127.0.0.1',),
help_text=_("IP addresses to ignore during traffic accountability."),
validators=[lambda hosts: (validate_ip_address(host) for host in hosts)],
)
2015-03-10 21:51:10 +00:00
2015-10-03 20:02:43 +00:00
# TODO sane defaults
2015-04-27 14:54:17 +00:00
WEBSITES_SAAS_DIRECTIVES = Setting('WEBSITES_SAAS_DIRECTIVES',
{
2015-06-22 14:14:16 +00:00
'wordpress-saas': ('fpm', '/var/run/fpm/pangea-5.4-fpm.sock', '/home/httpd/wordpress-mu/'),
2015-09-23 12:22:32 +00:00
'drupal-saas': ('fpm', '/var/run/fpm/pangea-5.4-fpm.sock', '/home/httpd/drupal-mu/'),
2015-10-03 20:02:43 +00:00
'dokuwiki-saas': ('fpm', '/var/run/fpm/pangea-5.4-fpm.sock', '/home/httpd/dokuwiki-mu/'),
'moodle-saas': ('fpm', '/var/run/fpm/pangea-5.4-fpm.sock', '/home/httpd/moodle-mu/'),
2015-04-27 14:54:17 +00:00
},
)
2015-03-23 15:36:51 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_DEFAULT_SSL_CERT = Setting('WEBSITES_DEFAULT_SSL_CERT',
''
)
2015-03-23 15:36:51 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_DEFAULT_SSL_KEY = Setting('WEBSITES_DEFAULT_SSL_KEY',
''
)
2015-03-23 15:36:51 +00:00
2015-04-26 13:53:00 +00:00
WEBSITES_DEFAULT_SSL_CA = Setting('WEBSITES_DEFAULT_SSL_CA',
''
)
2015-03-27 19:50:54 +00:00
2015-04-27 14:54:17 +00:00
WEBSITES_VHOST_EXTRA_DIRECTIVES = Setting('WEBSITES_VHOST_EXTRA_DIRECTIVES',
(),
2015-04-26 13:53:00 +00:00
help_text=(
"(<location>, <directive>), <br>"
"i.e. ('/cgi-bin/', 'ScriptAlias /cgi-bin/ %(home)s/cgi-bin/')"
)
)