diff options
| author | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-10-26 19:11:28 +0100 |
|---|---|---|
| committer | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-10-26 19:11:28 +0100 |
| commit | 0e1035eac1a3359edb44c998abc7f76d6f7ad985 (patch) | |
| tree | 3ef91532383f713324239a6797f0219da129236f /searx/__init__.py | |
| parent | c36c935b03cc87ddfcac5ce3ded333be73387a7a (diff) | |
| parent | 79f1676e318d36704687966fd124b7f29ddc21fa (diff) | |
Merge https://github.com/asciimoo/searx into template_oscar
Conflicts:
searx/translations/de/LC_MESSAGES/messages.po
searx/translations/en/LC_MESSAGES/messages.po
searx/translations/es/LC_MESSAGES/messages.po
searx/translations/fr/LC_MESSAGES/messages.po
searx/translations/hu/LC_MESSAGES/messages.po
searx/translations/it/LC_MESSAGES/messages.po
searx/translations/nl/LC_MESSAGES/messages.po
searx/webapp.py
Diffstat (limited to 'searx/__init__.py')
| -rw-r--r-- | searx/__init__.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/searx/__init__.py b/searx/__init__.py index 17da2f353..46685817a 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -17,6 +17,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. from os import environ from os.path import realpath, dirname, join, abspath +from searx.https_rewrite import load_https_rules try: from yaml import load except: @@ -27,14 +28,24 @@ except: searx_dir = abspath(dirname(__file__)) engine_dir = dirname(realpath(__file__)) -# if possible set path to settings using the enviroment variable SEARX_SETTINGS_PATH +# if possible set path to settings using the +# enviroment variable SEARX_SETTINGS_PATH if 'SEARX_SETTINGS_PATH' in environ: settings_path = environ['SEARX_SETTINGS_PATH'] # otherwise using default path else: settings_path = join(searx_dir, 'settings.yml') +if 'SEARX_HTTPS_REWRITE_PATH' in environ: + https_rewrite_path = environ['SEARX_HTTPS_REWRITE_PATH'] +else: + https_rewrite_path = join(searx_dir, 'https_rules') # load settings with open(settings_path) as settings_yaml: settings = load(settings_yaml) + +# load https rules only if https rewrite is enabled +if settings.get('server', {}).get('https_rewrite'): + # loade https rules + load_https_rules(https_rewrite_path) |