Skip to content

Instantly share code, notes, and snippets.

@fedir
Created October 17, 2014 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedir/5b1b050d56e414495e02 to your computer and use it in GitHub Desktop.
Save fedir/5b1b050d56e414495e02 to your computer and use it in GitHub Desktop.
Simple shell renderer with example of usage
export DEVELOPER="fedir"
export PROJECT_KEY="toto"
./render templates/vhostDev > templates/toto
#!/usr/bin/python
# Usage : render templateFile > renderedFile
import fileinput
import os
import re
def transform(match):
return os.getenv(match.group(1))
for line in fileinput.input():
print re.sub('\$(\w+)', transform, line)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/$DEVELOPER/www/$PROJECT_KEY/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/$DEVELOPER/www/$PROJECT_KEY/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /home/$DEVELOPER/www/$PROJECT_KEY/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
CustomLog /home/$DEVELOPER/www/$PROJECT_KEY/logs/access.log combined
Alias /xcache-admin "/usr/share/xcache/admin/"
<Directory "/usr/share/xcache/admin/">
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment