1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00

Delete iiab-make-apache-config.py

This commit is contained in:
A Holt 2019-09-29 23:01:00 -04:00 committed by GitHub
parent 38b855d690
commit 5e15944ad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,40 +0,0 @@
#!/usr/bin/python
# write out proxy definitions for zim currently loaded
import os, sys, syslog
iiab_zim_path = "{{ iiab_zim_path }}"
kiwix_apache_config = "/etc/{{ apache_config_dir }}/kiwix.conf"
def main ():
content = iiab_zim_path + "/content/"
index = iiab_zim_path + "/index/"
# remove existing file
try:
os.remove(kiwix_apache_config)
except:
pass
with open(kiwix_apache_config, 'w') as fp:
fp.write("RewriteEngine on\n")
fp.write("ProxyPreserveHost on\n")
fp.write("ProxyPass /kiwix http://127.0.0.1:3000\n")
fp.write("ProxyPassReverse /kiwix http://127.0.0.1:3000\n")
for filename in os.listdir(content):
zimpos = filename.find(".zim")
if zimpos != -1:
filename = filename[:zimpos]
fp.write("RewriteRule %s(.*) http://127.0.0.1:3000/%s$1 [P]\n"% (filename,filename))
fp.write("ProxyPassReverse %s$1 http://localhost:3000/%s$1\n" % (filename,filename))
if __name__ == "__main__":
# Run the main routine
main()
# vim: tabstop=3 shiftwidth=3 expandtab softtabstop=3