Skip to content

Commit a85ddf0

Browse files
author
John Carr
committed
Add a new auto-www option to the apache recipe
1 parent a21b9ce commit a85ddf0

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

isotoma.recipe.apache/README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ sslcert
4848
The full pathname of the ssl certificate, if required
4949
sslkey
5050
The full pathname of the key for the ssl certificate
51+
auto-www
52+
If true, the recipe will have a ServerAlias for www.${sitename}. If your sitename already has a www prefix, the alias will be sitename with the prefix trimmed.
5153

5254
Repository
5355
----------

isotoma.recipe.apache/isotoma/recipe/apache/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,18 @@ def install(self):
5252
if not os.path.isdir(self.outputdir):
5353
os.mkdir(self.outputdir)
5454
opt = self.options.copy()
55+
5556
# turn a list of sslca's into an actual list
5657
opt['sslca'] = [x.strip() for x in opt.get("sslca", "").strip().split()]
5758
opt['aliases'] = [x.strip() for x in opt.get('aliases', '').strip().split()]
59+
60+
# if we have auto-www on, add additional alias:
61+
if self.options.get("auto-www", "False") == "True":
62+
if opt['sitename'].startswith("www."):
63+
opt['aliases'].append(opt['sitename'][4:])
64+
else:
65+
opt['aliases'].append("www.%s" % opt['sitename'])
66+
5867
template = open(self.options['template']).read()
5968
cfgfilename = self.options['configfile']
6069
c = Template(template, searchList = opt)
@@ -67,6 +76,6 @@ def mkpasswd(self):
6776
pw = htpasswd.HtpasswdFile(self.options['passwdfile'], create=True)
6877
pw.update(self.options["username"], self.options["password"])
6978
pw.save()
70-
79+
7180
def update(self):
7281
pass

isotoma.recipe.apache/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup, find_packages
22

3-
version = '0.0.10'
3+
version = '0.0.11'
44

55
setup(
66
name = 'isotoma.recipe.apache',

0 commit comments

Comments
 (0)